[ < ] | [ > ] | [ << ] | [ 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 1.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 doubly
linked list. 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.
sy_volatile
sy_forward_ref
sy_weakrefr
weakref
alias to another symbol.
sy_weakrefd
weakref
aliases,
and has not had any direct references.
bsym
asymbol
that
will be used in writing the object file.
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
weakref
alias or
symbol that has not been strongly referenced.
S_IS_WEAKREFR
weakref
alias.
S_IS_WEAKREFD
weakref
alias and has not
had any strong references.
S_IS_VOLATILE
=
operator, equ
, or set
.
S_IS_FORWARD_REF
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_SET_WEAKREFR
weakref
directive. The symbol it
aliases must have been set to the value expression before this point. If the
alias has already been used, the symbol is marked as used too.
S_CLEAR_WEAKREFR
weakref
alias status of a symbol. This is implicitly called
whenever a symbol is defined or set to a new expression.
S_SET_WEAKREFD
weakref
directive.
Implicitly marks the symbol as weak, but see below. It should only be called
if the referenced symbol has just been added to the symbol table.
S_SET_WEAKREFD
weakref
aliased status of a symbol. This is implicitly called
whenever the symbol is looked up, as part of a direct reference or a
definition, but not as part of a weakref
directive.
S_SET_VOLATILE
S_CLEAR_VOLATILE
S_SET_FORWARD_REF
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.
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] | [ ? ] |