diff options
-rw-r--r-- | gas/symbols.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/gas/symbols.c b/gas/symbols.c index 445160a..c20eaf5 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -5,7 +5,7 @@ This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) +the Free Software Foundation; either version 2, or (at your option) any later version. GAS is distributed in the hope that it will be useful, @@ -133,6 +133,32 @@ local_label_name(n, augend) return(symbol_name_build); } /* local_label_name() */ +/* + * decode name that may have been generated by local_label_name() above. If + * the name wasn't generated by local_label_name(), then return it unaltered. + * This is used for error messages. + */ + +char *decode_local_label_name(s) +char *s; +{ + char *symbol_decode; + int label_number; + int label_version; + char *message_format = "\"%d\" (instance number %s of a local label)"; + + if (s[0] != 'L' + || s[2] != 1) { + return(s); + } /* not a local_label_name() generated name. */ + + label_number = s[1] - '0'; + + (void) sprintf(symbol_decode = obstack_alloc(¬es, strlen(s + 3) + strlen(message_format) + 10), + message_format, label_number, s + 3); + + return(symbol_decode); +} /* decode_local_label_name() */ void local_colon (n) int n; /* just saw "n:" */ @@ -175,7 +201,10 @@ fragS *frag; /* Associated fragment */ obstack_grow(¬es, name, name_length); preserved_copy_of_name = obstack_finish(¬es); symbolP = (symbolS *)obstack_alloc(¬es, sizeof(symbolS)); - + + /* symbol must be born in some fixed state. This seems as good as any. */ + memset(symbolP, 0, sizeof(symbolS)); + #if STRIP_UNDERSCORE S_SET_NAME(symbolP, (*preserved_copy_of_name == '_' ? preserved_copy_of_name + 1 @@ -186,10 +215,11 @@ fragS *frag; /* Associated fragment */ S_SET_SEGMENT(symbolP, segment); S_SET_VALUE(symbolP, value); - symbol_clear_list_pointers(symbolP); +/* symbol_clear_list_pointers(symbolP); uneeded if symbol is born zeroed. */ symbolP->sy_frag = frag; - symbolP->sy_forward = NULL; /* JF */ + /* krm: uneeded if symbol is born zeroed. + symbolP->sy_forward = NULL; */ /* JF */ symbolP->sy_number = ~0; symbolP->sy_name_offset = ~0; @@ -309,7 +339,7 @@ void colon(sym_name) /* just seen "x:" - rattle symbols & frags */ * This only used to be allowed on VMS gas, but Sun cc * on the sparc also depends on it. */ - char New_Type = SEGMENT_TO_SYMBOL_TYPE((int) now_seg); +/* char New_Type = SEGMENT_TO_SYMBOL_TYPE((int) now_seg); */ if (((!S_IS_DEBUG(symbolP) && !S_IS_DEFINED(symbolP) && S_IS_EXTERNAL(symbolP)) || (S_GET_SEGMENT(symbolP) == SEG_BSS)) |