summaryrefslogtreecommitdiff
path: root/gas/struc-symbol.h
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-01-10 11:48:26 +0000
committerTristan Gingold <gingold@adacore.com>2012-01-10 11:48:26 +0000
commit158184ac9e4ab97b97c6a9bb840db46661901585 (patch)
treee50d0bb3eb5dba3e97d93fcaaf58a37724b8bd6d /gas/struc-symbol.h
parent52546677d16665d5807657b453c808d1d625c309 (diff)
downloadbinutils-gdb-158184ac9e4ab97b97c6a9bb840db46661901585.tar.gz
2012-01-10 Tristan Gingold <gingold@adacore.com>
* struc-symbol.h (struct symbol_flags): New struct, created from... (struct symbol): ... this one. Add sy_flags field, remove flag fields. (struct local_symbol): Replace lsy_marker field by lsy_flags. Adjust comment. (local_symbol_resolved_p): Adjust. (local_symbol_mark_resolved): Likewise. * symbols.c (LOCAL_SYMBOL_CHECK): Adjust. (local_symbol_make, local_symbol_convert, colon) (symbol_clone_if_forward_ref, verify_symbol_chain) (resolve_symbol_value, snapshot_symbol, S_GET_VALUE) (S_IS_WEAKREFR, S_IS_WEAKREFD, S_IS_VOLATILE, S_IS_FORWARD_REF) (S_SET_WEAKREFR, S_CLEAR_WEAKREFR, S_SET_WEAKREFD) (S_CLEAR_WEAKREFD, S_SET_VOLATILE, S_CLEAR_VOLATILE) (S_SET_FORWARD_REF, symbol_same_p, 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_equated_reloc_p, dot_symbol_init) (print_symbol_value_1): Adjust.
Diffstat (limited to 'gas/struc-symbol.h')
-rw-r--r--gas/struc-symbol.h61
1 files changed, 36 insertions, 25 deletions
diff --git a/gas/struc-symbol.h b/gas/struc-symbol.h
index e31703b68f4..1dbb9d2c352 100644
--- a/gas/struc-symbol.h
+++ b/gas/struc-symbol.h
@@ -22,33 +22,22 @@
#ifndef __struc_symbol_h__
#define __struc_symbol_h__
-/* The information we keep for a symbol. Note that the symbol table
- holds pointers both to this and to local_symbol structures. See
- below. */
-
-struct symbol
+struct symbol_flags
{
- /* BFD symbol */
- asymbol *bsym;
+ /* Wether the symbol is a local_symbol. */
+ unsigned int sy_local_symbol : 1;
- /* The value of the symbol. */
- expressionS sy_value;
+ /* Wether symbol has been written. */
+ unsigned int sy_written : 1;
- /* Forwards and (optionally) backwards chain pointers. */
- struct symbol *sy_next;
- struct symbol *sy_previous;
-
- /* Pointer to the frag this symbol is attached to, if any.
- Otherwise, NULL. */
- struct frag *sy_frag;
-
- unsigned int written : 1;
/* Whether symbol value has been completely resolved (used during
final pass over symbol table). */
unsigned int sy_resolved : 1;
+
/* Whether the symbol value is currently being resolved (used to
detect loops in symbol dependencies). */
unsigned int sy_resolving : 1;
+
/* Whether the symbol value is used in a reloc. This is used to
ensure that symbols used in relocs are written out, even if they
are local and would otherwise not be. */
@@ -80,6 +69,30 @@ struct symbol
before. It is cleared as soon as any direct reference to the
symbol is present. */
unsigned int sy_weakrefd : 1;
+};
+
+/* The information we keep for a symbol. Note that the symbol table
+ holds pointers both to this and to local_symbol structures. See
+ below. */
+
+struct symbol
+{
+ /* Symbol flags. */
+ struct symbol_flags sy_flags;
+
+ /* BFD symbol */
+ asymbol *bsym;
+
+ /* The value of the symbol. */
+ expressionS sy_value;
+
+ /* Forwards and (optionally) backwards chain pointers. */
+ struct symbol *sy_next;
+ struct symbol *sy_previous;
+
+ /* Pointer to the frag this symbol is attached to, if any.
+ Otherwise, NULL. */
+ struct frag *sy_frag;
#ifdef OBJ_SYMFIELD_TYPE
OBJ_SYMFIELD_TYPE sy_obj;
@@ -107,9 +120,8 @@ struct symbol
struct local_symbol
{
- /* This pointer is always NULL to indicate that this is a local
- symbol. */
- asymbol *lsy_marker;
+ /* Symbol flags. Only sy_local_symbol and sy_resolved are relevant. */
+ struct symbol_flags lsy_flags;
/* The symbol section. This also serves as a flag. If this is
reg_section, then this symbol has been converted into a regular
@@ -120,8 +132,7 @@ struct local_symbol
const char *lsy_name;
/* The symbol frag or the real symbol, depending upon the value in
- lsy_section. If the symbol has been fully resolved, lsy_frag is
- set to NULL. */
+ lsy_section. */
union
{
fragS *lsy_frag;
@@ -138,8 +149,8 @@ struct local_symbol
#define local_symbol_converted_p(l) ((l)->lsy_section == reg_section)
#define local_symbol_mark_converted(l) ((l)->lsy_section = reg_section)
-#define local_symbol_resolved_p(l) ((l)->u.lsy_frag == NULL)
-#define local_symbol_mark_resolved(l) ((l)->u.lsy_frag = NULL)
+#define local_symbol_resolved_p(l) ((l)->lsy_flags.sy_resolved)
+#define local_symbol_mark_resolved(l) ((l)->lsy_flags.sy_resolved = 1)
#define local_symbol_get_frag(l) ((l)->u.lsy_frag)
#define local_symbol_set_frag(l, f) ((l)->u.lsy_frag = (f))
#define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym)