diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-07-05 19:59:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-07-05 19:59:07 +0000 |
commit | 56dc989a91a6bb112bb6bd112906b55229e127f0 (patch) | |
tree | 7c44f127eedc3e04b5ec1d904d0a2904ca4be280 /gas/symbols.c | |
parent | f219dc655ad997093ccb3a0518907e5a8cd2b237 (diff) | |
download | gdb-56dc989a91a6bb112bb6bd112906b55229e127f0.zip gdb-56dc989a91a6bb112bb6bd112906b55229e127f0.tar.gz gdb-56dc989a91a6bb112bb6bd112906b55229e127f0.tar.bz2 |
* symbols.c (S_SET_EXTERNAL): Warn if symbol is weak.
(S_CLEAR_EXTERNAL): Likewise.
(S_SET_WEAK): Warn if symbol is global.
PR 6750.
Diffstat (limited to 'gas/symbols.c')
-rw-r--r-- | gas/symbols.c | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/gas/symbols.c b/gas/symbols.c index c46876f..8fd395f 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -157,13 +157,10 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */ { register symbolS *symbolP; /* symbol we are working with */ -#ifdef LOCAL_LABELS_DOLLAR /* Sun local labels go out of scope whenever a non-local symbol is defined. */ - - if (*sym_name != 'L') + if (LOCAL_LABELS_DOLLAR && *sym_name != 'L') dollar_label_clear (); -#endif /* LOCAL_LABELS_DOLLAR */ #ifndef WORKING_DOT_WORD if (new_broken_words) @@ -765,8 +762,6 @@ resolve_symbol_value (symp) } } -#ifdef LOCAL_LABELS_DOLLAR - /* Dollar labels look like a number followed by a dollar sign. Eg, "42$". They are *really* local. That is, they go out of scope whenever we see a label that isn't local. Also, like fb labels, there can be multiple @@ -918,10 +913,6 @@ dollar_label_name (n, augend) return symbol_name_build; } -#endif /* LOCAL_LABELS_DOLLAR */ - -#ifdef LOCAL_LABELS_FB - /* * Sombody else's idea of local labels. They are made by "n:" where n * is any decimal digit. Refer to them with @@ -1091,9 +1082,6 @@ fb_label_name (n, augend) return (symbol_name_build); } /* fb_label_name() */ -#endif /* LOCAL_LABELS_FB */ - - /* * decode name that may have been generated by foo_label_name() above. If * the name wasn't generated by foo_label_name(), then return it unaltered. @@ -1112,37 +1100,26 @@ decode_local_label_name (s) const char *message_format = "\"%d\" (instance number %d of a %s label)"; if (s[0] != 'L') - return (s); + return s; for (label_number = 0, p = s + 1; isdigit (*p); ++p) - { - label_number = (10 * label_number) + *p - '0'; - } + label_number = (10 * label_number) + *p - '0'; if (*p == 1) - { - type = "dollar"; - } + type = "dollar"; else if (*p == 2) - { - type = "fb"; - } + type = "fb"; else - { - return (s); - } + return s; - for (instance_number = 0, p = s + 1; isdigit (*p); ++p) - { - instance_number = (10 * instance_number) + *p - '0'; - } + for (instance_number = 0, p++; isdigit (*p); ++p) + instance_number = (10 * instance_number) + *p - '0'; symbol_decode = obstack_alloc (¬es, strlen (message_format) + 30); - (void) sprintf (symbol_decode, message_format, label_number, - instance_number, type); + sprintf (symbol_decode, message_format, label_number, instance_number, type); - return (symbol_decode); -} /* decode_local_label_name() */ + return symbol_decode; +} /* Get the value of a symbol. */ @@ -1281,6 +1258,8 @@ void S_SET_EXTERNAL (s) symbolS *s; { + if ((s->bsym->flags & BSF_WEAK) != 0) + as_warn ("%s already declared as weak", S_GET_NAME (s)); s->bsym->flags |= BSF_GLOBAL; s->bsym->flags &= ~(BSF_LOCAL|BSF_WEAK); } @@ -1289,6 +1268,8 @@ void S_CLEAR_EXTERNAL (s) symbolS *s; { + if ((s->bsym->flags & BSF_WEAK) != 0) + as_warn ("%s already declared as weak", S_GET_NAME (s)); s->bsym->flags |= BSF_LOCAL; s->bsym->flags &= ~(BSF_GLOBAL|BSF_WEAK); } @@ -1297,6 +1278,8 @@ void S_SET_WEAK (s) symbolS *s; { + if ((s->bsym->flags & BSF_GLOBAL) != 0) + as_warn ("%s already declared as global", S_GET_NAME (s)); s->bsym->flags |= BSF_WEAK; s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL); } @@ -1328,20 +1311,23 @@ symbol_begin () #endif abs_symbol.sy_value.X_op = O_constant; -#ifdef LOCAL_LABELS_FB - fb_label_init (); -#endif /* LOCAL_LABELS_FB */ + if (LOCAL_LABELS_FB) + fb_label_init (); } int indent_level; +#if 0 + static void indent () { printf ("%*s", indent_level * 4, ""); } +#endif + void print_expr_1 PARAMS ((FILE *, expressionS *)); void print_symbol_value_1 PARAMS ((FILE *, symbolS *)); @@ -1353,7 +1339,7 @@ print_symbol_value_1 (file, sym) const char *name = S_GET_NAME (sym); if (!name || !name[0]) name = "(unnamed)"; - fprintf (file, "sym %lx %s", sym, name); + fprintf (file, "sym %lx %s", (unsigned long) sym, name); if (sym->sy_frag != &zero_address_frag) fprintf (file, " frag %lx", (long) sym->sy_frag); if (sym->written) |