gcc.info: Label Output
Go forward to Initialization
Go backward to Uninitialized Data
Go up to Assembler Format
Go to the top op gcc
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
STREAM the assembler definition of a label named NAME. Use the
expression `assemble_name (STREAM, NAME)' to output the name
itself; before and after that, output the additional assembler
syntax for defining the name, and a newline.
`ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)'
A C statement (sans semicolon) to output to the stdio stream
STREAM any text necessary for declaring the name NAME of a
function which is being defined. This macro is responsible for
outputting the label definition (perhaps using
`ASM_OUTPUT_LABEL'). The argument DECL is the `FUNCTION_DECL'
tree 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_LABEL').
`ASM_DECLARE_FUNCTION_SIZE (STREAM, NAME, DECL)'
A C statement (sans semicolon) to output to the stdio stream
STREAM any text necessary for declaring the size of a function
which is being defined. The argument NAME is the name of the
function. The argument DECL is the `FUNCTION_DECL' tree node
representing the function.
If this macro is not defined, then the function size is not
defined.
`ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL)'
A C statement (sans semicolon) to output to the stdio stream
STREAM any text necessary for declaring the name NAME of an
initialized variable which is being defined. This macro must
output the label definition (perhaps using `ASM_OUTPUT_LABEL').
The argument DECL is the `VAR_DECL' tree 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').
`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.
`ASM_GLOBALIZE_LABEL (STREAM, NAME)'
A C statement (sans semicolon) to output to the stdio stream
STREAM some commands that will make the label NAME global; that
is, available for reference from other files. Use the expression
`assemble_name (STREAM, NAME)' to output the name itself; before
and after that, output the additional assembler syntax for making
that name global, and a newline.
`ASM_WEAKEN_LABEL'
A C statement (sans semicolon) to output to the stdio stream
STREAM some commands that will make the label NAME weak; that is,
available for reference from other files but only used if no other
definition is available. Use the expression `assemble_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, GNU CC will not support weak
symbols and you should not define the `SUPPORTS_WEAK' macro.
`SUPPORTS_WEAK'
A C expression which evaluates to true if the target supports weak
symbols.
If you don't define this macro, `defaults.h' provides a default
definition. If `ASM_WEAKEN_LABEL' is defined, the default
definition is `1'; otherwise, it is `0'. Define this macro if you
want to control weak symbol support with a compiler flag such as
`-melf'.
`MAKE_DECL_ONE_ONLY'
A C statement (sans semicolon) to mark DECL to 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 the `COMDAT'
section flags in the Microsoft Windows PE/COFF format, and this
support requires changes to DECL, 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.c' provides a default
definition. If `MAKE_DECL_ONE_ONLY' is defined, the default
definition is `1'; otherwise, it is `0'. Define this macro if you
want to control one-only symbol support with a compiler flag, or if
setting the `DECL_ONE_ONLY' flag is enough to mark a declaration to
be emitted as one-only.
`ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)'
A C statement (sans semicolon) to output to the stdio stream
STREAM any text necessary for declaring the name of an external
symbol named NAME which is referenced in this compilation but not
defined. The value of DECL is 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.
`ASM_OUTPUT_EXTERNAL_LIBCALL (STREAM, SYMREF)'
A C statement (sans semicolon) to output on STREAM an assembler
pseudo-op to declare a library function name external. The name
of the library function is given by SYMREF, which has type `rtx'
and is a `symbol_ref'.
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.
`ASM_OUTPUT_LABELREF (STREAM, NAME)'
A C statement (sans semicolon) to output to the stdio stream
STREAM a reference in assembler syntax to a label named NAME.
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 in `assemble_name'.
`ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)'
A C statement to output to the stdio stream STREAM a label whose
name is made from the string PREFIX and the number NUM.
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 `L' at
the beginning of a label has this effect. You should find out what
convention your system uses, and follow it.
The usual definition of this macro is as follows:
fprintf (STREAM, "L%s%d:\n", PREFIX, NUM)
`ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)'
A C statement to store into the string STRING a label whose name
is made from the string PREFIX and the number NUM.
This string, when output subsequently by `assemble_name', should
produce the output that `ASM_OUTPUT_INTERNAL_LABEL' would produce
with the same PREFIX and NUM.
If the string begins with `*', then `assemble_name' will output
the rest of the string unchanged. It is often convenient for
`ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the
string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
output the string, and may change it. (Of course,
`ASM_OUTPUT_LABELREF' is 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 type
`char *') a newly allocated string made from the string NAME and
the number NUMBER, with some suitable punctuation added. Use
`alloca' to get space for the string.
The string will be used as an argument to `ASM_OUTPUT_LABELREF' to
produce an assembler label for an internal static variable whose
name is NAME. Therefore, the string must be such as to result in
valid assembler code. The argument NUMBER is 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.
`ASM_OUTPUT_DEF (STREAM, NAME, VALUE)'
A C statement to output to the stdio stream STREAM assembler code
which defines (equates) the symbol NAME to have the value VALUE.
If SET_ASM_OP is defined, a default definition is provided which is
correct for most systems.
`ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL (STREAM, SYMBOL, HIGH, LOW)'
A C statement to output to the stdio stream STREAM assembler code
which defines (equates) the symbol SYMBOL to have a value equal to
the difference of the two symbols HIGH and LOW, i.e. HIGH minus
LOW. GNU CC guarantees that the symbols HIGH and LOW are already
known by the assembler so that the difference resolves into a
constant.
If SET_ASM_OP is defined, a default definition is provided which is
correct for most systems.
`ASM_OUTPUT_WEAK_ALIAS (STREAM, NAME, VALUE)'
A C statement to output to the stdio stream STREAM assembler code
which defines (equates) the weak symbol NAME to have the value
VALUE.
Define this macro if the target only supports weak aliases; define
ASM_OUTPUT_DEF instead 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.
BUF is an expression of type `char *' which gives you a buffer in
which to store the name; its length is as long as CLASS_NAME,
CAT_NAME and SEL_NAME put together, plus 50 characters extra.
The argument IS_INST specifies whether the method is an instance
method or a class method; CLASS_NAME is the name of the class;
CAT_NAME is the name of the category (or NULL if the method is not
in a category); and SEL_NAME is 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.
Created Wed Sep 1 16:42:25 2004 on bee with info_to_html version 0.9.6.