* symbols.c (symbol_new): Don't call debug_verify_symchain.

(symbol_append): Set sy_next and sy_previous when adding a single
	symbol to an empty list.  Call debug_verify_symchain.
	(verify_symbol_chain): Use assert, not know.
This commit is contained in:
Ian Lance Taylor
1997-03-16 18:50:27 +00:00
parent b587eb70ca
commit e95ef7c1b1
2 changed files with 53 additions and 21 deletions

View File

@ -1,3 +1,10 @@
Sun Mar 16 13:49:21 1997 Ian Lance Taylor <ian@cygnus.com>
* symbols.c (symbol_new): Don't call debug_verify_symchain.
(symbol_append): Set sy_next and sy_previous when adding a single
symbol to an empty list. Call debug_verify_symchain.
(verify_symbol_chain): Use assert, not know.
Sat Mar 15 20:27:12 1997 Fred Fish <fnf@cygnus.com> Sat Mar 15 20:27:12 1997 Fred Fish <fnf@cygnus.com>
* NEWS: Note BeOS support. * NEWS: Note BeOS support.

View File

@ -1,5 +1,5 @@
/* symbols.c -symbol table- /* symbols.c -symbol table-
Copyright (C) 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -15,8 +15,9 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to along with GAS; see the file COPYING. If not, write to the Free
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* #define DEBUG_SYMS / * to debug symbol list maintenance */ /* #define DEBUG_SYMS / * to debug symbol list maintenance */
@ -84,7 +85,6 @@ symbol_new (name, segment, valu, frag)
} }
#endif #endif
symbol_append (symbolP, symbol_lastP, &symbol_rootP, &symbol_lastP); symbol_append (symbolP, symbol_lastP, &symbol_rootP, &symbol_lastP);
debug_verify_symchain (symbol_rootP, symbol_lastP);
return symbolP; return symbolP;
} }
@ -173,8 +173,19 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */
/* Sun local labels go out of scope whenever a non-local symbol is /* Sun local labels go out of scope whenever a non-local symbol is
defined. */ defined. */
if (LOCAL_LABELS_DOLLAR && ! LOCAL_LABEL (sym_name)) if (LOCAL_LABELS_DOLLAR)
dollar_label_clear (); {
int local;
#ifdef BFD_ASSEMBLER
local = bfd_is_local_label_name (stdoutput, sym_name);
#else
local = LOCAL_LABEL (sym_name);
#endif
if (! local)
dollar_label_clear ();
}
#ifndef WORKING_DOT_WORD #ifndef WORKING_DOT_WORD
if (new_broken_words) if (new_broken_words)
@ -479,6 +490,10 @@ symbol_append (addme, target, rootPP, lastPP)
{ {
know (*rootPP == NULL); know (*rootPP == NULL);
know (*lastPP == NULL); know (*lastPP == NULL);
addme->sy_next = NULL;
#ifdef SYMBOLS_NEED_BACKPOINTERS
addme->sy_previous = NULL;
#endif
*rootPP = addme; *rootPP = addme;
*lastPP = addme; *lastPP = addme;
return; return;
@ -502,6 +517,8 @@ symbol_append (addme, target, rootPP, lastPP)
#ifdef SYMBOLS_NEED_BACKPOINTERS #ifdef SYMBOLS_NEED_BACKPOINTERS
addme->sy_previous = target; addme->sy_previous = target;
#endif /* SYMBOLS_NEED_BACKPOINTERS */ #endif /* SYMBOLS_NEED_BACKPOINTERS */
debug_verify_symchain (symbol_rootP, symbol_lastP);
} }
/* Set the chain pointers of SYMBOL to null. */ /* Set the chain pointers of SYMBOL to null. */
@ -586,7 +603,7 @@ verify_symbol_chain (rootP, lastP)
for (; symbol_next (symbolP) != NULL; symbolP = symbol_next (symbolP)) for (; symbol_next (symbolP) != NULL; symbolP = symbol_next (symbolP))
{ {
#ifdef SYMBOLS_NEED_BACKPOINTERS #ifdef SYMBOLS_NEED_BACKPOINTERS
know (symbolP->sy_next->sy_previous == symbolP); assert (symbolP->sy_next->sy_previous == symbolP);
#else #else
/* Walk the list anyways, to make sure pointers are still good. */ /* Walk the list anyways, to make sure pointers are still good. */
; ;
@ -704,7 +721,11 @@ resolve_symbol_value (symp)
is equated. */ is equated. */
if (! S_IS_DEFINED (symp->sy_value.X_add_symbol) if (! S_IS_DEFINED (symp->sy_value.X_add_symbol)
|| S_IS_COMMON (symp->sy_value.X_add_symbol)) || S_IS_COMMON (symp->sy_value.X_add_symbol))
symp->sy_value.X_op = O_symbol; {
symp->sy_value.X_op = O_symbol;
S_SET_SEGMENT (symp,
S_GET_SEGMENT (symp->sy_value.X_add_symbol));
}
else else
{ {
S_SET_VALUE (symp, S_SET_VALUE (symp,
@ -782,26 +803,30 @@ resolve_symbol_value (symp)
if (expr_symbol_where (symp, &file, &line)) if (expr_symbol_where (symp, &file, &line))
{ {
if (seg_left == undefined_section if (seg_left == undefined_section)
|| seg_right == undefined_section)
as_bad_where (file, line, as_bad_where (file, line,
"undefined symbol %s in operation", "undefined symbol %s in operation",
(seg_left == undefined_section S_GET_NAME (symp->sy_value.X_add_symbol));
? S_GET_NAME (symp->sy_value.X_add_symbol) if (seg_right == undefined_section)
: S_GET_NAME (symp->sy_value.X_op_symbol))); as_bad_where (file, line,
else "undefined symbol %s in operation",
S_GET_NAME (symp->sy_value.X_op_symbol));
if (seg_left != undefined_section
&& seg_right != undefined_section)
as_bad_where (file, line, "invalid section for operation"); as_bad_where (file, line, "invalid section for operation");
} }
else else
{ {
if (seg_left == undefined_section if (seg_left == undefined_section)
|| seg_right == undefined_section)
as_bad ("undefined symbol %s in operation setting %s", as_bad ("undefined symbol %s in operation setting %s",
(seg_left == undefined_section S_GET_NAME (symp->sy_value.X_add_symbol),
? S_GET_NAME (symp->sy_value.X_add_symbol)
: S_GET_NAME (symp->sy_value.X_op_symbol)),
S_GET_NAME (symp)); S_GET_NAME (symp));
else if (seg_right == undefined_section)
as_bad ("undefined symbol %s in operation setting %s",
S_GET_NAME (symp->sy_value.X_op_symbol),
S_GET_NAME (symp));
if (seg_left != undefined_section
&& seg_right != undefined_section)
as_bad ("invalid section for operation setting %s", as_bad ("invalid section for operation setting %s",
S_GET_NAME (symp)); S_GET_NAME (symp));
} }
@ -1343,7 +1368,7 @@ S_IS_LOCAL (s)
&& (strchr (name, '\001') && (strchr (name, '\001')
|| strchr (name, '\002') || strchr (name, '\002')
|| (! flag_keep_locals || (! flag_keep_locals
&& (LOCAL_LABEL (name) && (bfd_is_local_label (stdoutput, s->bsym)
|| (flag_mri || (flag_mri
&& name[0] == '?' && name[0] == '?'
&& name[1] == '?'))))); && name[1] == '?')))));