gccint: Label Output
1
1 18.20.4 Output and Generation of Labels
1 ---------------------------------------
1
1 This is about outputting labels.
1
1 -- Macro: ASM_OUTPUT_LABEL (STREAM, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 the assembler definition of a label named NAME. Use the expression
1 'assemble_name (STREAM, NAME)' to output the name itself; before
1 and after that, output the additional assembler syntax for defining
1 the name, and a newline. A default definition of this macro is
1 provided which is correct for most systems.
1
1 -- Macro: ASM_OUTPUT_FUNCTION_LABEL (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 the assembler definition of a label named NAME of a function. Use
1 the expression 'assemble_name (STREAM, NAME)' to output the name
1 itself; before and after that, output the additional assembler
1 syntax for defining the name, and a newline. A default definition
1 of this macro is provided which is correct for most systems.
1
1 If this macro is not defined, then the function name is defined in
1 the usual manner as a label (by means of 'ASM_OUTPUT_LABEL').
1
1 -- Macro: ASM_OUTPUT_INTERNAL_LABEL (STREAM, NAME)
1 Identical to 'ASM_OUTPUT_LABEL', except that NAME is known to refer
1 to a compiler-generated label. The default definition uses
1 'assemble_name_raw', which is like 'assemble_name' except that it
1 is more efficient.
1
1 -- Macro: SIZE_ASM_OP
1 A C string containing the appropriate assembler directive to
1 specify the size of a symbol, without any arguments. On systems
1 that use ELF, the default (in 'config/elfos.h') is '"\t.size\t"';
1 on other systems, the default is not to define this macro.
1
1 Define this macro only if it is correct to use the default
1 definitions of 'ASM_OUTPUT_SIZE_DIRECTIVE' and
1 'ASM_OUTPUT_MEASURED_SIZE' for your system. If you need your own
1 custom definitions of those macros, or if you do not need explicit
1 symbol sizes at all, do not define this macro.
1
1 -- Macro: ASM_OUTPUT_SIZE_DIRECTIVE (STREAM, NAME, SIZE)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 a directive telling the assembler that the size of the symbol NAME
1 is SIZE. SIZE is a 'HOST_WIDE_INT'. If you define 'SIZE_ASM_OP',
1 a default definition of this macro is provided.
1
1 -- Macro: ASM_OUTPUT_MEASURED_SIZE (STREAM, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 a directive telling the assembler to calculate the size of the
1 symbol NAME by subtracting its address from the current address.
1
1 If you define 'SIZE_ASM_OP', a default definition of this macro is
1 provided. The default assumes that the assembler recognizes a
1 special '.' symbol as referring to the current address, and can
1 calculate the difference between this and another symbol. If your
1 assembler does not recognize '.' or cannot do calculations with it,
1 you will need to redefine 'ASM_OUTPUT_MEASURED_SIZE' to use some
1 other technique.
1
1 -- Macro: NO_DOLLAR_IN_LABEL
1 Define this macro if the assembler does not accept the character
1 '$' in label names. By default constructors and destructors in G++
1 have '$' in the identifiers. If this macro is defined, '.' is used
1 instead.
1
1 -- Macro: NO_DOT_IN_LABEL
1 Define this macro if the assembler does not accept the character
1 '.' in label names. By default constructors and destructors in G++
1 have names that use '.'. If this macro is defined, these names are
1 rewritten to avoid '.'.
1
1 -- Macro: TYPE_ASM_OP
1 A C string containing the appropriate assembler directive to
1 specify the type of a symbol, without any arguments. On systems
1 that use ELF, the default (in 'config/elfos.h') is '"\t.type\t"';
1 on other systems, the default is not to define this macro.
1
1 Define this macro only if it is correct to use the default
1 definition of 'ASM_OUTPUT_TYPE_DIRECTIVE' for your system. If you
1 need your own custom definition of this macro, or if you do not
1 need explicit symbol types at all, do not define this macro.
1
1 -- Macro: TYPE_OPERAND_FMT
1 A C string which specifies (using 'printf' syntax) the format of
1 the second operand to 'TYPE_ASM_OP'. On systems that use ELF, the
1 default (in 'config/elfos.h') is '"@%s"'; on other systems, the
1 default is not to define this macro.
1
1 Define this macro only if it is correct to use the default
1 definition of 'ASM_OUTPUT_TYPE_DIRECTIVE' for your system. If you
1 need your own custom definition of this macro, or if you do not
1 need explicit symbol types at all, do not define this macro.
1
1 -- Macro: ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, TYPE)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 a directive telling the assembler that the type of the symbol NAME
1 is TYPE. TYPE is a C string; currently, that string is always
1 either '"function"' or '"object"', but you should not count on
1 this.
1
1 If you define 'TYPE_ASM_OP' and 'TYPE_OPERAND_FMT', a default
1 definition of this macro is provided.
1
1 -- Macro: ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the name NAME of a function which
1 is being defined. This macro is responsible for outputting the
1 label definition (perhaps using 'ASM_OUTPUT_FUNCTION_LABEL'). The
1 argument DECL is the 'FUNCTION_DECL' tree node representing the
1 function.
1
1 If this macro is not defined, then the function name is defined in
1 the usual manner as a label (by means of
1 'ASM_OUTPUT_FUNCTION_LABEL').
1
1 You may wish to use 'ASM_OUTPUT_TYPE_DIRECTIVE' in the definition
1 of this macro.
1
1 -- Macro: ASM_DECLARE_FUNCTION_SIZE (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the size of a function which is
1 being defined. The argument NAME is the name of the function. The
1 argument DECL is the 'FUNCTION_DECL' tree node representing the
1 function.
1
1 If this macro is not defined, then the function size is not
1 defined.
1
1 You may wish to use 'ASM_OUTPUT_MEASURED_SIZE' in the definition of
1 this macro.
1
1 -- Macro: ASM_DECLARE_COLD_FUNCTION_NAME (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the name NAME of a cold function
1 partition which is being defined. This macro is responsible for
1 outputting the label definition (perhaps using
1 'ASM_OUTPUT_FUNCTION_LABEL'). The argument DECL is the
1 'FUNCTION_DECL' tree node representing the function.
1
1 If this macro is not defined, then the cold partition name is
1 defined in the usual manner as a label (by means of
1 'ASM_OUTPUT_LABEL').
1
1 You may wish to use 'ASM_OUTPUT_TYPE_DIRECTIVE' in the definition
1 of this macro.
1
1 -- Macro: ASM_DECLARE_COLD_FUNCTION_SIZE (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the size of a cold function
1 partition which is being defined. The argument NAME is the name of
1 the cold partition of the function. The argument DECL is the
1 'FUNCTION_DECL' tree node representing the function.
1
1 If this macro is not defined, then the partition size is not
1 defined.
1
1 You may wish to use 'ASM_OUTPUT_MEASURED_SIZE' in the definition of
1 this macro.
1
1 -- Macro: ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the name NAME of an initialized
1 variable which is being defined. This macro must output the label
1 definition (perhaps using 'ASM_OUTPUT_LABEL'). The argument DECL
1 is the 'VAR_DECL' tree node representing the variable.
1
1 If this macro is not defined, then the variable name is defined in
1 the usual manner as a label (by means of 'ASM_OUTPUT_LABEL').
1
1 You may wish to use 'ASM_OUTPUT_TYPE_DIRECTIVE' and/or
1 'ASM_OUTPUT_SIZE_DIRECTIVE' in the definition of this macro.
1
1 -- Target Hook: void TARGET_ASM_DECLARE_CONSTANT_NAME (FILE *FILE,
1 const char *NAME, const_tree EXPR, HOST_WIDE_INT SIZE)
1 A target hook to output to the stdio stream FILE any text necessary
1 for declaring the name NAME of a constant which is being defined.
1 This target hook is responsible for outputting the label definition
1 (perhaps using 'assemble_label'). The argument EXP is the value of
1 the constant, and SIZE is the size of the constant in bytes. The
1 NAME will be an internal label.
1
1 The default version of this target hook, define the NAME in the
1 usual manner as a label (by means of 'assemble_label').
1
1 You may wish to use 'ASM_OUTPUT_TYPE_DIRECTIVE' in this target
1 hook.
1
1 -- Macro: ASM_DECLARE_REGISTER_GLOBAL (STREAM, DECL, REGNO, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for claiming a register REGNO for a global
1 variable DECL with name NAME.
1
1 If you don't define this macro, that is equivalent to defining it
1 to do nothing.
1
1 -- Macro: ASM_FINISH_DECLARE_OBJECT (STREAM, DECL, TOPLEVEL, ATEND)
1 A C statement (sans semicolon) to finish up declaring a variable
1 name once the compiler has processed its initializer fully and thus
1 has had a chance to determine the size of an array when controlled
1 by an initializer. This is used on systems where it's necessary to
1 declare something about the size of the object.
1
1 If you don't define this macro, that is equivalent to defining it
1 to do nothing.
1
1 You may wish to use 'ASM_OUTPUT_SIZE_DIRECTIVE' and/or
1 'ASM_OUTPUT_MEASURED_SIZE' in the definition of this macro.
1
1 -- Target Hook: void TARGET_ASM_GLOBALIZE_LABEL (FILE *STREAM, const
1 char *NAME)
1 This target hook is a function to output to the stdio stream STREAM
1 some commands that will make the label NAME global; that is,
1 available for reference from other files.
1
1 The default implementation relies on a proper definition of
1 'GLOBAL_ASM_OP'.
1
1 -- Target Hook: void TARGET_ASM_GLOBALIZE_DECL_NAME (FILE *STREAM, tree
1 DECL)
1 This target hook is a function to output to the stdio stream STREAM
1 some commands that will make the name associated with DECL global;
1 that is, available for reference from other files.
1
1 The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL
1 target hook.
1
1 -- Target Hook: void TARGET_ASM_ASSEMBLE_UNDEFINED_DECL (FILE *STREAM,
1 const char *NAME, const_tree DECL)
1 This target hook is a function to output to the stdio stream STREAM
1 some commands that will declare the name associated with DECL which
1 is not defined in the current translation unit. Most assemblers do
1 not require anything to be output in this case.
1
1 -- Macro: ASM_WEAKEN_LABEL (STREAM, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 some commands that will make the label NAME weak; that is,
1 available for reference from other files but only used if no other
1 definition is available. Use the expression 'assemble_name
1 (STREAM, NAME)' to output the name itself; before and after that,
1 output the additional assembler syntax for making that name weak,
1 and a newline.
1
1 If you don't define this macro or 'ASM_WEAKEN_DECL', GCC will not
1 support weak symbols and you should not define the 'SUPPORTS_WEAK'
1 macro.
1
1 -- Macro: ASM_WEAKEN_DECL (STREAM, DECL, NAME, VALUE)
1 Combines (and replaces) the function of 'ASM_WEAKEN_LABEL' and
1 'ASM_OUTPUT_WEAK_ALIAS', allowing access to the associated function
1 or variable decl. If VALUE is not 'NULL', this C statement should
1 output to the stdio stream STREAM assembler code which defines
1 (equates) the weak symbol NAME to have the value VALUE. If VALUE
1 is 'NULL', it should output commands to make NAME weak.
1
1 -- Macro: ASM_OUTPUT_WEAKREF (STREAM, DECL, NAME, VALUE)
1 Outputs a directive that enables NAME to be used to refer to symbol
1 VALUE with weak-symbol semantics. 'decl' is the declaration of
1 'name'.
1
1 -- Macro: SUPPORTS_WEAK
1 A preprocessor constant expression which evaluates to true if the
1 target supports weak symbols.
1
1 If you don't define this macro, 'defaults.h' provides a default
1 definition. If either 'ASM_WEAKEN_LABEL' or 'ASM_WEAKEN_DECL' is
1 defined, the default definition is '1'; otherwise, it is '0'.
1
1 -- Macro: TARGET_SUPPORTS_WEAK
1 A C expression which evaluates to true if the target supports weak
1 symbols.
1
1 If you don't define this macro, 'defaults.h' provides a default
1 definition. The default definition is '(SUPPORTS_WEAK)'. Define
1 this macro if you want to control weak symbol support with a
1 compiler flag such as '-melf'.
1
1 -- Macro: MAKE_DECL_ONE_ONLY (DECL)
1 A C statement (sans semicolon) to mark DECL to be emitted as a
1 public symbol such that extra copies in multiple translation units
1 will be discarded by the linker. Define this macro if your object
1 file format provides support for this concept, such as the 'COMDAT'
1 section flags in the Microsoft Windows PE/COFF format, and this
1 support requires changes to DECL, such as putting it in a separate
1 section.
1
1 -- Macro: SUPPORTS_ONE_ONLY
1 A C expression which evaluates to true if the target supports
1 one-only semantics.
1
1 If you don't define this macro, 'varasm.c' provides a default
1 definition. If 'MAKE_DECL_ONE_ONLY' is defined, the default
1 definition is '1'; otherwise, it is '0'. Define this macro if you
1 want to control one-only symbol support with a compiler flag, or if
1 setting the 'DECL_ONE_ONLY' flag is enough to mark a declaration to
1 be emitted as one-only.
1
1 -- Target Hook: void TARGET_ASM_ASSEMBLE_VISIBILITY (tree DECL, int
1 VISIBILITY)
1 This target hook is a function to output to ASM_OUT_FILE some
1 commands that will make the symbol(s) associated with DECL have
1 hidden, protected or internal visibility as specified by
1 VISIBILITY.
1
1 -- Macro: TARGET_WEAK_NOT_IN_ARCHIVE_TOC
1 A C expression that evaluates to true if the target's linker
1 expects that weak symbols do not appear in a static archive's table
1 of contents. The default is '0'.
1
1 Leaving weak symbols out of an archive's table of contents means
1 that, if a symbol will only have a definition in one translation
1 unit and will have undefined references from other translation
1 units, that symbol should not be weak. Defining this macro to be
1 nonzero will thus have the effect that certain symbols that would
1 normally be weak (explicit template instantiations, and vtables for
1 polymorphic classes with noninline key methods) will instead be
1 nonweak.
1
1 The C++ ABI requires this macro to be zero. Define this macro for
1 targets where full C++ ABI compliance is impossible and where
1 linker restrictions require weak symbols to be left out of a static
1 archive's table of contents.
1
1 -- Macro: ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 any text necessary for declaring the name of an external symbol
1 named NAME which is referenced in this compilation but not defined.
1 The value of DECL is the tree node for the declaration.
1
1 This macro need not be defined if it does not need to output
1 anything. The GNU assembler and most Unix assemblers don't require
1 anything.
1
1 -- Target Hook: void TARGET_ASM_EXTERNAL_LIBCALL (rtx SYMREF)
1 This target hook is a function to output to ASM_OUT_FILE an
1 assembler pseudo-op to declare a library function name external.
1 The name of the library function is given by SYMREF, which is a
1 'symbol_ref'.
1
1 -- Target Hook: void TARGET_ASM_MARK_DECL_PRESERVED (const char
1 *SYMBOL)
1 This target hook is a function to output to ASM_OUT_FILE an
1 assembler directive to annotate SYMBOL as used. The Darwin target
1 uses the .no_dead_code_strip directive.
1
1 -- Macro: ASM_OUTPUT_LABELREF (STREAM, NAME)
1 A C statement (sans semicolon) to output to the stdio stream STREAM
1 a reference in assembler syntax to a label named NAME. This should
1 add '_' to the front of the name, if that is customary on your
1 operating system, as it is in most Berkeley Unix systems. This
1 macro is used in 'assemble_name'.
1
1 -- Target Hook: tree TARGET_MANGLE_ASSEMBLER_NAME (const char *NAME)
1 Given a symbol NAME, perform same mangling as 'varasm.c''s
1 'assemble_name', but in memory rather than to a file stream,
1 returning result as an 'IDENTIFIER_NODE'. Required for correct LTO
1 symtabs. The default implementation calls the
1 'TARGET_STRIP_NAME_ENCODING' hook and then prepends the
1 'USER_LABEL_PREFIX', if any.
1
1 -- Macro: ASM_OUTPUT_SYMBOL_REF (STREAM, SYM)
1 A C statement (sans semicolon) to output a reference to
1 'SYMBOL_REF' SYM. If not defined, 'assemble_name' will be used to
1 output the name of the symbol. This macro may be used to modify
1 the way a symbol is referenced depending on information encoded by
1 'TARGET_ENCODE_SECTION_INFO'.
1
1 -- Macro: ASM_OUTPUT_LABEL_REF (STREAM, BUF)
1 A C statement (sans semicolon) to output a reference to BUF, the
1 result of 'ASM_GENERATE_INTERNAL_LABEL'. If not defined,
1 'assemble_name' will be used to output the name of the symbol.
1 This macro is not used by 'output_asm_label', or the '%l' specifier
1 that calls it; the intention is that this macro should be set when
1 it is necessary to output a label differently when its address is
1 being taken.
1
1 -- Target Hook: void TARGET_ASM_INTERNAL_LABEL (FILE *STREAM, const
1 char *PREFIX, unsigned long LABELNO)
1 A function to output to the stdio stream STREAM a label whose name
1 is made from the string PREFIX and the number LABELNO.
1
1 It is absolutely essential that these labels be distinct from the
1 labels used for user-level functions and variables. Otherwise,
1 certain programs will have name conflicts with internal labels.
1
1 It is desirable to exclude internal labels from the symbol table of
1 the object file. Most assemblers have a naming convention for
1 labels that should be excluded; on many systems, the letter 'L' at
1 the beginning of a label has this effect. You should find out what
1 convention your system uses, and follow it.
1
1 The default version of this function utilizes
1 'ASM_GENERATE_INTERNAL_LABEL'.
1
1 -- Macro: ASM_OUTPUT_DEBUG_LABEL (STREAM, PREFIX, NUM)
1 A C statement to output to the stdio stream STREAM a debug info
1 label whose name is made from the string PREFIX and the number NUM.
1 This is useful for VLIW targets, where debug info labels may need
1 to be treated differently than branch target labels. On some
1 systems, branch target labels must be at the beginning of
1 instruction bundles, but debug info labels can occur in the middle
1 of instruction bundles.
1
1 If this macro is not defined, then
1 '(*targetm.asm_out.internal_label)' will be used.
1
1 -- Macro: ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)
1 A C statement to store into the string STRING a label whose name is
1 made from the string PREFIX and the number NUM.
1
1 This string, when output subsequently by 'assemble_name', should
1 produce the output that '(*targetm.asm_out.internal_label)' would
1 produce with the same PREFIX and NUM.
1
1 If the string begins with '*', then 'assemble_name' will output the
1 rest of the string unchanged. It is often convenient for
1 'ASM_GENERATE_INTERNAL_LABEL' to use '*' in this way. If the
1 string doesn't start with '*', then 'ASM_OUTPUT_LABELREF' gets to
1 output the string, and may change it. (Of course,
1 'ASM_OUTPUT_LABELREF' is also part of your machine description, so
1 you should know what it does on your machine.)
1
1 -- Macro: ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)
1 A C expression to assign to OUTVAR (which is a variable of type
1 'char *') a newly allocated string made from the string NAME and
1 the number NUMBER, with some suitable punctuation added. Use
1 'alloca' to get space for the string.
1
1 The string will be used as an argument to 'ASM_OUTPUT_LABELREF' to
1 produce an assembler label for an internal static variable whose
1 name is NAME. Therefore, the string must be such as to result in
1 valid assembler code. The argument NUMBER is different each time
1 this macro is executed; it prevents conflicts between
1 similarly-named internal static variables in different scopes.
1
1 Ideally this string should not be a valid C identifier, to prevent
1 any conflict with the user's own symbols. Most assemblers allow
1 periods or percent signs in assembler symbols; putting at least one
1 of these between the name and the number will suffice.
1
1 If this macro is not defined, a default definition will be provided
1 which is correct for most systems.
1
1 -- Macro: ASM_OUTPUT_DEF (STREAM, NAME, VALUE)
1 A C statement to output to the stdio stream STREAM assembler code
1 which defines (equates) the symbol NAME to have the value VALUE.
1
1 If 'SET_ASM_OP' is defined, a default definition is provided which
1 is correct for most systems.
1
1 -- Macro: ASM_OUTPUT_DEF_FROM_DECLS (STREAM, DECL_OF_NAME,
1 DECL_OF_VALUE)
1 A C statement to output to the stdio stream STREAM assembler code
1 which defines (equates) the symbol whose tree node is DECL_OF_NAME
1 to have the value of the tree node DECL_OF_VALUE. This macro will
1 be used in preference to 'ASM_OUTPUT_DEF' if it is defined and if
1 the tree nodes are available.
1
1 If 'SET_ASM_OP' is defined, a default definition is provided which
1 is correct for most systems.
1
1 -- Macro: TARGET_DEFERRED_OUTPUT_DEFS (DECL_OF_NAME, DECL_OF_VALUE)
1 A C statement that evaluates to true if the assembler code which
1 defines (equates) the symbol whose tree node is DECL_OF_NAME to
1 have the value of the tree node DECL_OF_VALUE should be emitted
1 near the end of the current compilation unit. The default is to
1 not defer output of defines. This macro affects defines output by
1 'ASM_OUTPUT_DEF' and 'ASM_OUTPUT_DEF_FROM_DECLS'.
1
1 -- Macro: ASM_OUTPUT_WEAK_ALIAS (STREAM, NAME, VALUE)
1 A C statement to output to the stdio stream STREAM assembler code
1 which defines (equates) the weak symbol NAME to have the value
1 VALUE. If VALUE is 'NULL', it defines NAME as an undefined weak
1 symbol.
1
1 Define this macro if the target only supports weak aliases; define
1 'ASM_OUTPUT_DEF' instead if possible.
1
1 -- Macro: OBJC_GEN_METHOD_LABEL (BUF, IS_INST, CLASS_NAME, CAT_NAME,
1 SEL_NAME)
1 Define this macro to override the default assembler names used for
1 Objective-C methods.
1
1 The default name is a unique method number followed by the name of
1 the class (e.g. '_1_Foo'). For methods in categories, the name of
1 the category is also included in the assembler name (e.g.
1 '_1_Foo_Bar').
1
1 These names are safe on most systems, but make debugging difficult
1 since the method's selector is not present in the name. Therefore,
1 particular systems define other ways of computing names.
1
1 BUF is an expression of type 'char *' which gives you a buffer in
1 which to store the name; its length is as long as CLASS_NAME,
1 CAT_NAME and SEL_NAME put together, plus 50 characters extra.
1
1 The argument IS_INST specifies whether the method is an instance
1 method or a class method; CLASS_NAME is the name of the class;
1 CAT_NAME is the name of the category (or 'NULL' if the method is
1 not in a category); and SEL_NAME is the name of the selector.
1
1 On systems where the assembler can handle quoted names, you can use
1 this macro to provide more human-readable names.
1