Output and Generation of Labels#
This is about outputting labels.
-
ASM_OUTPUT_LABEL(stream, name)#
A C statement (sans semicolon) to output to the stdio stream
streamthe assembler definition of a label namedname. Use the expressionassemble_name (stream, name)to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. A default definition of this macro is provided which is correct for most systems.
-
ASM_OUTPUT_FUNCTION_LABEL(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamthe assembler definition of a label namednameof a function. Use the expressionassemble_name (stream, name)to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. A default definition of this macro is provided which is correct for most systems.If this macro is not defined, then the function name is defined in the usual manner as a label (by means of
ASM_OUTPUT_LABEL).
-
ASM_OUTPUT_INTERNAL_LABEL(stream, name)#
Identical to
ASM_OUTPUT_LABEL, except thatnameis known to refer to a compiler-generated label. The default definition usesassemble_name_raw, which is likeassemble_nameexcept that it is more efficient.
-
SIZE_ASM_OP#
A C string containing the appropriate assembler directive to specify the size of a symbol, without any arguments. On systems that use ELF, the default (in
config/elfos.h) is"\t.size\t"; on other systems, the default is not to define this macro.Define this macro only if it is correct to use the default definitions of
ASM_OUTPUT_SIZE_DIRECTIVEandASM_OUTPUT_MEASURED_SIZEfor your system. If you need your own custom definitions of those macros, or if you do not need explicit symbol sizes at all, do not define this macro.
-
ASM_OUTPUT_SIZE_DIRECTIVE(stream, name, size)#
A C statement (sans semicolon) to output to the stdio stream
streama directive telling the assembler that the size of the symbolnameissize.sizeis aHOST_WIDE_INT. If you defineSIZE_ASM_OP, a default definition of this macro is provided.
-
ASM_OUTPUT_MEASURED_SIZE(stream, name)#
A C statement (sans semicolon) to output to the stdio stream
streama directive telling the assembler to calculate the size of the symbolnameby subtracting its address from the current address.If you define
SIZE_ASM_OP, a default definition of this macro is provided. The default assumes that the assembler recognizes a special.symbol as referring to the current address, and can calculate the difference between this and another symbol. If your assembler does not recognize.or cannot do calculations with it, you will need to redefineASM_OUTPUT_MEASURED_SIZEto use some other technique.
-
NO_DOLLAR_IN_LABEL#
Define this macro if the assembler does not accept the character
$in label names. By default constructors and destructors in G++ have$in the identifiers. If this macro is defined,.is used instead.
-
NO_DOT_IN_LABEL#
Define this macro if the assembler does not accept the character
.in label names. By default constructors and destructors in G++ have names that use.. If this macro is defined, these names are rewritten to avoid..
-
TYPE_ASM_OP#
A C string containing the appropriate assembler directive to specify the type of a symbol, without any arguments. On systems that use ELF, the default (in
config/elfos.h) is"\t.type\t"; on other systems, the default is not to define this macro.Define this macro only if it is correct to use the default definition of
ASM_OUTPUT_TYPE_DIRECTIVEfor your system. If you need your own custom definition of this macro, or if you do not need explicit symbol types at all, do not define this macro.
-
TYPE_OPERAND_FMT#
A C string which specifies (using
printfsyntax) the format of the second operand toTYPE_ASM_OP. On systems that use ELF, the default (inconfig/elfos.h) is"@%s"; on other systems, the default is not to define this macro.Define this macro only if it is correct to use the default definition of
ASM_OUTPUT_TYPE_DIRECTIVEfor your system. If you need your own custom definition of this macro, or if you do not need explicit symbol types at all, do not define this macro.
-
ASM_OUTPUT_TYPE_DIRECTIVE(stream, type)#
A C statement (sans semicolon) to output to the stdio stream
streama directive telling the assembler that the type of the symbolnameistype.typeis a C string; currently, that string is always either"function"or"object", but you should not count on this.If you define
TYPE_ASM_OPandTYPE_OPERAND_FMT, a default definition of this macro is provided.
-
ASM_DECLARE_FUNCTION_NAME(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the namenameof a function which is being defined. This macro is responsible for outputting the label definition (perhaps usingASM_OUTPUT_FUNCTION_LABEL). The argumentdeclis theFUNCTION_DECLtree node representing the function.If this macro is not defined, then the function name is defined in the usual manner as a label (by means of
ASM_OUTPUT_FUNCTION_LABEL).You may wish to use
ASM_OUTPUT_TYPE_DIRECTIVEin the definition of this macro.
-
ASM_DECLARE_FUNCTION_SIZE(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the size of a function which is being defined. The argumentnameis the name of the function. The argumentdeclis theFUNCTION_DECLtree node representing the function.If this macro is not defined, then the function size is not defined.
You may wish to use
ASM_OUTPUT_MEASURED_SIZEin the definition of this macro.
-
ASM_DECLARE_COLD_FUNCTION_NAME(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the namenameof a cold function partition which is being defined. This macro is responsible for outputting the label definition (perhaps usingASM_OUTPUT_FUNCTION_LABEL). The argumentdeclis theFUNCTION_DECLtree node representing the function.If this macro is not defined, then the cold partition name is defined in the usual manner as a label (by means of
ASM_OUTPUT_LABEL).You may wish to use
ASM_OUTPUT_TYPE_DIRECTIVEin the definition of this macro.
-
ASM_DECLARE_COLD_FUNCTION_SIZE(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the size of a cold function partition which is being defined. The argumentnameis the name of the cold partition of the function. The argumentdeclis theFUNCTION_DECLtree node representing the function.If this macro is not defined, then the partition size is not defined.
You may wish to use
ASM_OUTPUT_MEASURED_SIZEin the definition of this macro.
-
ASM_DECLARE_OBJECT_NAME(stream, name, decl)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the namenameof an initialized variable which is being defined. This macro must output the label definition (perhaps usingASM_OUTPUT_LABEL). The argumentdeclis theVAR_DECLtree node representing the variable.If this macro is not defined, then the variable name is defined in the usual manner as a label (by means of
ASM_OUTPUT_LABEL).You may wish to use
ASM_OUTPUT_TYPE_DIRECTIVEand/orASM_OUTPUT_SIZE_DIRECTIVEin the definition of this macro.
-
void TARGET_ASM_DECLARE_CONSTANT_NAME(FILE *file, const char *name, const_tree expr, HOST_WIDE_INT size)#
A target hook to output to the stdio stream
fileany text necessary for declaring the namenameof a constant which is being defined. This target hook is responsible for outputting the label definition (perhaps usingassemble_label). The argumentexpis the value of the constant, andsizeis the size of the constant in bytes. Thenamewill be an internal label.The default version of this target hook, define the
namein the usual manner as a label (by means ofassemble_label).You may wish to use
ASM_OUTPUT_TYPE_DIRECTIVEin this target hook.
-
ASM_DECLARE_REGISTER_GLOBAL(stream, decl, regno, name)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for claiming a registerregnofor a global variabledeclwith namename.If you don’t define this macro, that is equivalent to defining it to do nothing.
-
ASM_FINISH_DECLARE_OBJECT(stream, decl, toplevel, atend)#
A C statement (sans semicolon) to finish up declaring a variable name once the compiler has processed its initializer fully and thus has had a chance to determine the size of an array when controlled by an initializer. This is used on systems where it’s necessary to declare something about the size of the object.
If you don’t define this macro, that is equivalent to defining it to do nothing.
You may wish to use
ASM_OUTPUT_SIZE_DIRECTIVEand/orASM_OUTPUT_MEASURED_SIZEin the definition of this macro.
-
void TARGET_ASM_GLOBALIZE_LABEL(FILE *stream, const char *name)#
This target hook is a function to output to the stdio stream
streamsome commands that will make the labelnameglobal; that is, available for reference from other files.The default implementation relies on a proper definition of
GLOBAL_ASM_OP.
-
void TARGET_ASM_GLOBALIZE_DECL_NAME(FILE *stream, tree decl)#
This target hook is a function to output to the stdio stream
streamsome commands that will make the name associated withdeclglobal; that is, available for reference from other files.The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.
-
void TARGET_ASM_ASSEMBLE_UNDEFINED_DECL(FILE *stream, const char *name, const_tree decl)#
This target hook is a function to output to the stdio stream
streamsome commands that will declare the name associated withdeclwhich is not defined in the current translation unit. Most assemblers do not require anything to be output in this case.
-
ASM_WEAKEN_LABEL(stream, name)#
A C statement (sans semicolon) to output to the stdio stream
streamsome commands that will make the labelnameweak; that is, available for reference from other files but only used if no other definition is available. Use the expressionassemble_name (stream, name)to output the name itself; before and after that, output the additional assembler syntax for making that name weak, and a newline.If you don’t define this macro or
ASM_WEAKEN_DECL, GCC will not support weak symbols and you should not define theSUPPORTS_WEAKmacro.
-
ASM_WEAKEN_DECL(stream, decl, name, value)#
Combines (and replaces) the function of
ASM_WEAKEN_LABELandASM_OUTPUT_WEAK_ALIAS, allowing access to the associated function or variable decl. Ifvalueis notNULL, this C statement should output to the stdio streamstreamassembler code which defines (equates) the weak symbolnameto have the valuevalue. IfvalueisNULL, it should output commands to makenameweak.
-
ASM_OUTPUT_WEAKREF(stream, decl, name, value)#
Outputs a directive that enables
nameto be used to refer to symbolvaluewith weak-symbol semantics.declis the declaration ofname.
-
SUPPORTS_WEAK#
A preprocessor constant expression which evaluates to true if the target supports weak symbols.
If you don’t define this macro,
defaults.hprovides a default definition. If eitherASM_WEAKEN_LABELorASM_WEAKEN_DECLis defined, the default definition is1; otherwise, it is0.
-
TARGET_SUPPORTS_WEAK#
A C expression which evaluates to true if the target supports weak symbols.
If you don’t define this macro,
defaults.hprovides a default definition. The default definition is(SUPPORTS_WEAK). Define this macro if you want to control weak symbol support with a compiler flag such as-melf.
-
MAKE_DECL_ONE_ONLY(decl)#
A C statement (sans semicolon) to mark
declto be emitted as a public symbol such that extra copies in multiple translation units will be discarded by the linker. Define this macro if your object file format provides support for this concept, such as theCOMDATsection flags in the Microsoft Windows PE/COFF format, and this support requires changes todecl, such as putting it in a separate section.
-
SUPPORTS_ONE_ONLY#
A C expression which evaluates to true if the target supports one-only semantics.
If you don’t define this macro,
varasm.ccprovides a default definition. IfMAKE_DECL_ONE_ONLYis defined, the default definition is1; otherwise, it is0. Define this macro if you want to control one-only symbol support with a compiler flag, or if setting theDECL_ONE_ONLYflag is enough to mark a declaration to be emitted as one-only.
-
void TARGET_ASM_ASSEMBLE_VISIBILITY(tree decl, int visibility)#
This target hook is a function to output to
asm_out_filesome commands that will make the symbol(s) associated withdeclhave hidden, protected or internal visibility as specified byvisibility.
-
TARGET_WEAK_NOT_IN_ARCHIVE_TOC#
A C expression that evaluates to true if the target’s linker expects that weak symbols do not appear in a static archive’s table of contents. The default is
0.Leaving weak symbols out of an archive’s table of contents means that, if a symbol will only have a definition in one translation unit and will have undefined references from other translation units, that symbol should not be weak. Defining this macro to be nonzero will thus have the effect that certain symbols that would normally be weak (explicit template instantiations, and vtables for polymorphic classes with noninline key methods) will instead be nonweak.
The C++ ABI requires this macro to be zero. Define this macro for targets where full C++ ABI compliance is impossible and where linker restrictions require weak symbols to be left out of a static archive’s table of contents.
-
ASM_OUTPUT_EXTERNAL(stream, decl, name)#
A C statement (sans semicolon) to output to the stdio stream
streamany text necessary for declaring the name of an external symbol namednamewhich is referenced in this compilation but not defined. The value ofdeclis the tree node for the declaration.This macro need not be defined if it does not need to output anything. The GNU assembler and most Unix assemblers don’t require anything.
-
void TARGET_ASM_EXTERNAL_LIBCALL(rtx symref)#
This target hook is a function to output to
asm_out_filean assembler pseudo-op to declare a library function name external. The name of the library function is given bysymref, which is asymbol_ref.
-
void TARGET_ASM_MARK_DECL_PRESERVED(const char *symbol)#
This target hook is a function to output to
asm_out_filean assembler directive to annotatesymbolas used. The Darwin target uses the .no_dead_code_strip directive.
-
ASM_OUTPUT_LABELREF(stream, name)#
A C statement (sans semicolon) to output to the stdio stream
streama reference in assembler syntax to a label namedname. This should add_to the front of the name, if that is customary on your operating system, as it is in most Berkeley Unix systems. This macro is used inassemble_name.
-
tree TARGET_MANGLE_ASSEMBLER_NAME(const char *name)#
Given a symbol
name, perform same mangling asvarasm.cc‘sassemble_name, but in memory rather than to a file stream, returning result as anIDENTIFIER_NODE. Required for correct LTO symtabs. The default implementation calls theTARGET_STRIP_NAME_ENCODINGhook and then prepends theUSER_LABEL_PREFIX, if any.
-
ASM_OUTPUT_SYMBOL_REF(stream, sym)#
A C statement (sans semicolon) to output a reference to
SYMBOL_REFsym. If not defined,assemble_namewill be used to output the name of the symbol. This macro may be used to modify the way a symbol is referenced depending on information encoded byTARGET_ENCODE_SECTION_INFO.
-
ASM_OUTPUT_LABEL_REF(stream, buf)#
A C statement (sans semicolon) to output a reference to
buf, the result ofASM_GENERATE_INTERNAL_LABEL. If not defined,assemble_namewill be used to output the name of the symbol. This macro is not used byoutput_asm_label, or the%lspecifier that calls it; the intention is that this macro should be set when it is necessary to output a label differently when its address is being taken.
-
void TARGET_ASM_INTERNAL_LABEL(FILE *stream, const char *prefix, unsigned long labelno)#
A function to output to the stdio stream
streama label whose name is made from the stringprefixand the numberlabelno.It is absolutely essential that these labels be distinct from the labels used for user-level functions and variables. Otherwise, certain programs will have name conflicts with internal labels.
It is desirable to exclude internal labels from the symbol table of the object file. Most assemblers have a naming convention for labels that should be excluded; on many systems, the letter
Lat the beginning of a label has this effect. You should find out what convention your system uses, and follow it.The default version of this function utilizes
ASM_GENERATE_INTERNAL_LABEL.
-
ASM_OUTPUT_DEBUG_LABEL(stream, prefix, num)#
A C statement to output to the stdio stream
streama debug info label whose name is made from the stringprefixand the numbernum. This is useful for VLIW targets, where debug info labels may need to be treated differently than branch target labels. On some systems, branch target labels must be at the beginning of instruction bundles, but debug info labels can occur in the middle of instruction bundles.If this macro is not defined, then
(*targetm.asm_out.internal_label)will be used.
-
ASM_GENERATE_INTERNAL_LABEL(string, prefix, num)#
A C statement to store into the string
stringa label whose name is made from the stringprefixand the numbernum.This string, when output subsequently by
assemble_name, should produce the output that(*targetm.asm_out.internal_label)would produce with the sameprefixandnum.If the string begins with
*, thenassemble_namewill output the rest of the string unchanged. It is often convenient forASM_GENERATE_INTERNAL_LABELto use*in this way. If the string doesn’t start with*, thenASM_OUTPUT_LABELREFgets to output the string, and may change it. (Of course,ASM_OUTPUT_LABELREFis also part of your machine description, so you should know what it does on your machine.)
-
ASM_FORMAT_PRIVATE_NAME(outvar, name, number)#
A C expression to assign to
outvar(which is a variable of typechar *) a newly allocated string made from the stringnameand the numbernumber, with some suitable punctuation added. Useallocato get space for the string.The string will be used as an argument to
ASM_OUTPUT_LABELREFto produce an assembler label for an internal static variable whose name isname. Therefore, the string must be such as to result in valid assembler code. The argumentnumberis different each time this macro is executed; it prevents conflicts between similarly-named internal static variables in different scopes.Ideally this string should not be a valid C identifier, to prevent any conflict with the user’s own symbols. Most assemblers allow periods or percent signs in assembler symbols; putting at least one of these between the name and the number will suffice.
If this macro is not defined, a default definition will be provided which is correct for most systems.
-
ASM_OUTPUT_DEF(stream, name, value)#
A C statement to output to the stdio stream
streamassembler code which defines (equates) the symbolnameto have the valuevalue.If
SET_ASM_OPis defined, a default definition is provided which is correct for most systems.
-
ASM_OUTPUT_DEF_FROM_DECLS(stream, decl_of_name, decl_of_value)#
A C statement to output to the stdio stream
streamassembler code which defines (equates) the symbol whose tree node isdecl_of_nameto have the value of the tree nodedecl_of_value. This macro will be used in preference toASM_OUTPUT_DEFif it is defined and if the tree nodes are available.If
SET_ASM_OPis defined, a default definition is provided which is correct for most systems.
-
TARGET_DEFERRED_OUTPUT_DEFS(decl_of_name, decl_of_value)#
A C statement that evaluates to true if the assembler code which defines (equates) the symbol whose tree node is
decl_of_nameto have the value of the tree nodedecl_of_valueshould be emitted near the end of the current compilation unit. The default is to not defer output of defines. This macro affects defines output byASM_OUTPUT_DEFandASM_OUTPUT_DEF_FROM_DECLS.
-
ASM_OUTPUT_WEAK_ALIAS(stream, name, value)#
A C statement to output to the stdio stream
streamassembler code which defines (equates) the weak symbolnameto have the valuevalue. IfvalueisNULL, it definesnameas an undefined weak symbol.Define this macro if the target only supports weak aliases; define
ASM_OUTPUT_DEFinstead if possible.
-
OBJC_GEN_METHOD_LABEL(buf, is_inst, class_name, cat_name, sel_name)#
Define this macro to override the default assembler names used for Objective-C methods.
The default name is a unique method number followed by the name of the class (e.g.
_1_Foo). For methods in categories, the name of the category is also included in the assembler name (e.g._1_Foo_Bar).These names are safe on most systems, but make debugging difficult since the method’s selector is not present in the name. Therefore, particular systems define other ways of computing names.
bufis an expression of typechar *which gives you a buffer in which to store the name; its length is as long asclass_name,cat_nameandsel_nameput together, plus 50 characters extra.The argument
is_instspecifies whether the method is an instance method or a class method;class_nameis the name of the class;cat_nameis the name of the category (orNULLif the method is not in a category); andsel_nameis the name of the selector.On systems where the assembler can handle quoted names, you can use this macro to provide more human-readable names.