[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The definition for the symbol structure, symbolS
, is located in
`struc-symbol.h'.
In general, the fields of this structure may not be referred to directly. Instead, you must use one of the accessor functions defined in `symbol.h'. These accessor functions should work for any GAS version.
Symbol structures contain the following fields:
sy_value
expressionS
that describes the value of the symbol. It might
refer to one or more other symbols; if so, its true value may not be known
until resolve_symbol_value
is called with finalize_syms non-zero
in write_object_file
.
The expression is often simply a constant. Before resolve_symbol_value
is called with finalize_syms set, the value is the offset from the frag
(see section 2.4 Frags). Afterward, the frag address has been added in.
sy_resolved
sy_resolving
sy_used_in_reloc
sy_next
sy_previous
symbolS
structures describe a singly or doubly
linked list. (If SYMBOLS_NEED_BACKPOINTERS
is not defined, the
sy_previous
field will be omitted; SYMBOLS_NEED_BACKPOINTERS
is
always defined if BFD_ASSEMBLER
.) These fields should be accessed with
the symbol_next
and symbol_previous
macros.
sy_frag
sy_used
sy_mri_common
COMMON
pseudo-op when assembling in MRI mode.
bsym
BFD_ASSEMBLER
is defined, this points to the BFD asymbol
that
will be used in writing the object file.
sy_name_offset
BFD_ASSEMBLER
is not defined.) This is the position of
the symbol's name in the string table of the object file. On some formats,
this will start at position 4, with position 0 reserved for unnamed symbols.
This field is not used until write_object_file
is called.
sy_symbol
BFD_ASSEMBLER
is not defined.) This is the
format-specific symbol structure, as it would be written into the object file.
sy_number
BFD_ASSEMBLER
is not defined.) This is a 24-bit symbol
number, for use in constructing relocation table entries.
sy_obj
OBJ_SYMFIELD_TYPE
. If no macro by
that name is defined in `obj-format.h', this field is not defined.
sy_tc
TC_SYMFIELD_TYPE
. If no macro
by that name is defined in `targ-cpu.h', this field is not defined.
Here is a description of the accessor functions. These should be used rather
than referring to the fields of symbolS
directly.
S_SET_VALUE
S_GET_VALUE
resolve_symbol_value
to be
called if necessary.
S_SET_SEGMENT
S_GET_SEGMENT
S_GET_NAME
S_SET_NAME
S_IS_EXTERNAL
S_IS_EXTERN
S_IS_EXTERNAL
. Don't use it.
S_IS_WEAK
S_IS_COMMON
S_IS_DEFINED
S_IS_DEBUG
S_IS_LOCAL
S_IS_EXTERNAL
. The `-L' assembler option affects the return value
of this function.
S_SET_EXTERNAL
S_CLEAR_EXTERNAL
S_SET_WEAK
S_GET_TYPE
S_GET_DESC
S_GET_OTHER
type
, desc
, and other
fields of the symbol. These
are only defined for object file formats for which they make sense (primarily
a.out).
S_SET_TYPE
S_SET_DESC
S_SET_OTHER
type
, desc
, and other
fields of the symbol. These
are only defined for object file formats for which they make sense (primarily
a.out).
S_GET_SIZE
S_SET_SIZE
symbol_get_value_expression
expressionS
structure which represents the value of
the symbol as an expression.
symbol_set_value_expression
symbol_set_frag
symbol_get_frag
symbol_mark_used
symbol_clear_used
symbol_used_p
symbol_mark_used_in_reloc
symbol_clear_used_in_reloc
symbol_used_in_reloc_p
symbol_mark_mri_common
symbol_clear_mri_common
symbol_mri_common_p
symbol_mark_written
symbol_clear_written
symbol_written_p
symbol_mark_resolved
symbol_resolved_p
symbol_section_p
symbol_equated_p
symbol_constant_p
symbol_get_bfdsym
symbol_set_bfdsym
symbol_get_obj
OBJ_SYMFIELD_TYPE
field of a symbol.
symbol_set_obj
OBJ_SYMFIELD_TYPE
field of a symbol.
symbol_get_tc
TC_SYMFIELD_TYPE
field of a symbol.
symbol_set_tc
TC_SYMFIELD_TYPE
field of a symbol.
When BFD_ASSEMBLER
is defined, GAS attempts to store local
symbols--symbols which will not be written to the output file--using a
different structure, struct local_symbol
. This structure can only
represent symbols whose value is an offset within a frag.
Code outside of the symbol handler will always deal with symbolS
structures and use the accessor functions. The accessor functions correctly
deal with local symbols. struct local_symbol
is much smaller than
symbolS
(which also automatically creates a bfd asymbol
structure), so this saves space when assembling large files.
The first field of symbolS
is bsym
, the pointer to the BFD
symbol. The first field of struct local_symbol
is a pointer which is
always set to NULL. This is how the symbol accessor functions can distinguish
local symbols from ordinary symbols. The symbol accessor functions
automatically convert a local symbol into an ordinary symbol when necessary.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |