gccint: File Framework
1
1 18.20.1 The Overall Framework of an Assembler File
1 --------------------------------------------------
1
1 This describes the overall framework of an assembly file.
1
1 -- Target Hook: void TARGET_ASM_FILE_START (void)
1 Output to 'asm_out_file' any text which the assembler expects to
1 find at the beginning of a file. The default behavior is
1 controlled by two flags, documented below. Unless your target's
1 assembler is quite unusual, if you override the default, you should
1 call 'default_file_start' at some point in your target hook. This
1 lets other target files rely on these variables.
1
1 -- Target Hook: bool TARGET_ASM_FILE_START_APP_OFF
1 If this flag is true, the text of the macro 'ASM_APP_OFF' will be
1 printed as the very first line in the assembly file, unless
1 '-fverbose-asm' is in effect. (If that macro has been defined to
1 the empty string, this variable has no effect.) With the normal
1 definition of 'ASM_APP_OFF', the effect is to notify the GNU
1 assembler that it need not bother stripping comments or extra
1 whitespace from its input. This allows it to work a bit faster.
1
1 The default is false. You should not set it to true unless you
1 have verified that your port does not generate any extra whitespace
1 or comments that will cause GAS to issue errors in NO_APP mode.
1
1 -- Target Hook: bool TARGET_ASM_FILE_START_FILE_DIRECTIVE
1 If this flag is true, 'output_file_directive' will be called for
1 the primary source file, immediately after printing 'ASM_APP_OFF'
1 (if that is enabled). Most ELF assemblers expect this to be done.
1 The default is false.
1
1 -- Target Hook: void TARGET_ASM_FILE_END (void)
1 Output to 'asm_out_file' any text which the assembler expects to
1 find at the end of a file. The default is to output nothing.
1
1 -- Function: void file_end_indicate_exec_stack ()
1 Some systems use a common convention, the '.note.GNU-stack' special
1 section, to indicate whether or not an object file relies on the
1 stack being executable. If your system uses this convention, you
1 should define 'TARGET_ASM_FILE_END' to this function. If you need
1 to do other things in that hook, have your hook function call this
1 function.
1
1 -- Target Hook: void TARGET_ASM_LTO_START (void)
1 Output to 'asm_out_file' any text which the assembler expects to
1 find at the start of an LTO section. The default is to output
1 nothing.
1
1 -- Target Hook: void TARGET_ASM_LTO_END (void)
1 Output to 'asm_out_file' any text which the assembler expects to
1 find at the end of an LTO section. The default is to output
1 nothing.
1
1 -- Target Hook: void TARGET_ASM_CODE_END (void)
1 Output to 'asm_out_file' any text which is needed before emitting
1 unwind info and debug info at the end of a file. Some targets emit
1 here PIC setup thunks that cannot be emitted at the end of file,
1 because they couldn't have unwind info then. The default is to
1 output nothing.
1
1 -- Macro: ASM_COMMENT_START
1 A C string constant describing how to begin a comment in the target
1 assembler language. The compiler assumes that the comment will end
1 at the end of the line.
1
1 -- Macro: ASM_APP_ON
1 A C string constant for text to be output before each 'asm'
1 statement or group of consecutive ones. Normally this is '"#APP"',
1 which is a comment that has no effect on most assemblers but tells
1 the GNU assembler that it must check the lines that follow for all
1 valid assembler constructs.
1
1 -- Macro: ASM_APP_OFF
1 A C string constant for text to be output after each 'asm'
1 statement or group of consecutive ones. Normally this is
1 '"#NO_APP"', which tells the GNU assembler to resume making the
1 time-saving assumptions that are valid for ordinary compiler
1 output.
1
1 -- Macro: ASM_OUTPUT_SOURCE_FILENAME (STREAM, NAME)
1 A C statement to output COFF information or DWARF debugging
1 information which indicates that filename NAME is the current
1 source file to the stdio stream STREAM.
1
1 This macro need not be defined if the standard form of output for
1 the file format in use is appropriate.
1
1 -- Target Hook: void TARGET_ASM_OUTPUT_SOURCE_FILENAME (FILE *FILE,
1 const char *NAME)
1 Output DWARF debugging information which indicates that filename
1 NAME is the current source file to the stdio stream FILE.
1
1 This target hook need not be defined if the standard form of output
1 for the file format in use is appropriate.
1
1 -- Target Hook: void TARGET_ASM_OUTPUT_IDENT (const char *NAME)
1 Output a string based on NAME, suitable for the '#ident' directive,
1 or the equivalent directive or pragma in non-C-family languages.
1 If this hook is not defined, nothing is output for the '#ident'
1 directive.
1
1 -- Macro: OUTPUT_QUOTED_STRING (STREAM, STRING)
1 A C statement to output the string STRING to the stdio stream
1 STREAM. If you do not call the function 'output_quoted_string' in
1 your config files, GCC will only call it to output filenames to the
1 assembler source. So you can use it to canonicalize the format of
1 the filename using this macro.
1
1 -- Target Hook: void TARGET_ASM_NAMED_SECTION (const char *NAME,
1 unsigned int FLAGS, tree DECL)
1 Output assembly directives to switch to section NAME. The section
1 should have attributes as specified by FLAGS, which is a bit mask
1 of the 'SECTION_*' flags defined in 'output.h'. If DECL is
1 non-NULL, it is the 'VAR_DECL' or 'FUNCTION_DECL' with which this
1 section is associated.
1
1 -- Target Hook: bool TARGET_ASM_ELF_FLAGS_NUMERIC (unsigned int FLAGS,
1 unsigned int *NUM)
1 This hook can be used to encode ELF section flags for which no
1 letter code has been defined in the assembler. It is called by
1 'default_asm_named_section' whenever the section flags need to be
1 emitted in the assembler output. If the hook returns true, then
1 the numerical value for ELF section flags should be calculated from
1 FLAGS and saved in *NUM; the value is printed out instead of the
1 normal sequence of letter codes. If the hook is not defined, or if
1 it returns false, then NUM is ignored and the traditional letter
1 sequence is emitted.
1
1 -- Target Hook: section * TARGET_ASM_FUNCTION_SECTION (tree DECL, enum
1 node_frequency FREQ, bool STARTUP, bool EXIT)
1 Return preferred text (sub)section for function DECL. Main purpose
1 of this function is to separate cold, normal and hot functions.
1 STARTUP is true when function is known to be used only at startup
1 (from static constructors or it is 'main()'). EXIT is true when
1 function is known to be used only at exit (from static
1 destructors). Return NULL if function should go to default text
1 section.
1
1 -- Target Hook: void TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS (FILE
1 *FILE, tree DECL, bool NEW_IS_COLD)
1 Used by the target to emit any assembler directives or additional
1 labels needed when a function is partitioned between different
1 sections. Output should be written to FILE. The function decl is
1 available as DECL and the new section is 'cold' if NEW_IS_COLD is
1 'true'.
1
1 -- Common Target Hook: bool TARGET_HAVE_NAMED_SECTIONS
1 This flag is true if the target supports
1 'TARGET_ASM_NAMED_SECTION'. It must not be modified by
1 command-line option processing.
1
1 -- Target Hook: bool TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
1 This flag is true if we can create zeroed data by switching to a
1 BSS section and then using 'ASM_OUTPUT_SKIP' to allocate the space.
1 This is true on most ELF targets.
1
1 -- Target Hook: unsigned int TARGET_SECTION_TYPE_FLAGS (tree DECL,
1 const char *NAME, int RELOC)
1 Choose a set of section attributes for use by
1 'TARGET_ASM_NAMED_SECTION' based on a variable or function decl, a
1 section name, and whether or not the declaration's initializer may
1 contain runtime relocations. DECL may be null, in which case
1 read-write data should be assumed.
1
1 The default version of this function handles choosing code vs data,
1 read-only vs read-write data, and 'flag_pic'. You should only need
1 to override this if your target has special flags that might be set
1 via '__attribute__'.
1
1 -- Target Hook: int TARGET_ASM_RECORD_GCC_SWITCHES (print_switch_type
1 TYPE, const char *TEXT)
1 Provides the target with the ability to record the gcc command line
1 switches that have been passed to the compiler, and options that
1 are enabled. The TYPE argument specifies what is being recorded.
1 It can take the following values:
1
1 'SWITCH_TYPE_PASSED'
1 TEXT is a command line switch that has been set by the user.
1
1 'SWITCH_TYPE_ENABLED'
1 TEXT is an option which has been enabled. This might be as a
1 direct result of a command line switch, or because it is
1 enabled by default or because it has been enabled as a side
1 effect of a different command line switch. For example, the
1 '-O2' switch enables various different individual optimization
1 passes.
1
1 'SWITCH_TYPE_DESCRIPTIVE'
1 TEXT is either NULL or some descriptive text which should be
1 ignored. If TEXT is NULL then it is being used to warn the
1 target hook that either recording is starting or ending. The
1 first time TYPE is SWITCH_TYPE_DESCRIPTIVE and TEXT is NULL,
1 the warning is for start up and the second time the warning is
1 for wind down. This feature is to allow the target hook to
1 make any necessary preparations before it starts to record
1 switches and to perform any necessary tidying up after it has
1 finished recording switches.
1
1 'SWITCH_TYPE_LINE_START'
1 This option can be ignored by this target hook.
1
1 'SWITCH_TYPE_LINE_END'
1 This option can be ignored by this target hook.
1
1 The hook's return value must be zero. Other return values may be
1 supported in the future.
1
1 By default this hook is set to NULL, but an example implementation
1 is provided for ELF based targets. Called ELF_RECORD_GCC_SWITCHES,
1 it records the switches as ASCII text inside a new, string
1 mergeable section in the assembler output file. The name of the
1 new section is provided by the
1 'TARGET_ASM_RECORD_GCC_SWITCHES_SECTION' target hook.
1
1 -- Target Hook: const char * TARGET_ASM_RECORD_GCC_SWITCHES_SECTION
1 This is the name of the section that will be created by the example
1 ELF implementation of the 'TARGET_ASM_RECORD_GCC_SWITCHES' target
1 hook.
1