From: Alan Modra Date: Wed, 12 Oct 2011 21:07:07 +0000 (+0000) Subject: * as.c (main): Define .gasversion. rather than __GAS_VERSION__. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6885131b49b28d67e4dc4758edb7e765b8b9f8b7;p=binutils-gdb.git * as.c (main): Define .gasversion. rather than __GAS_VERSION__. * frags.h (bss_address_frag): Delete (predefined_address_frag): New. * frags.c (frag_init): Init predefined_address_frag. Delete ref to bss_addres_frag. * symbols.c (S_CAN_BE_REDEFINED): New function. * symbols.h (S_CAN_BE_REDEFINED): Declare. * read.c (assign_symbol): Use S_CAN_BE_REDEFINED. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index a67250ea8c6..98cab137b75 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2011-10-13 Alan Modra + + * as.c (main): Define .gasversion. rather than __GAS_VERSION__. + * frags.h (bss_address_frag): Delete + (predefined_address_frag): New. + * frags.c (frag_init): Init predefined_address_frag. Delete ref + to bss_addres_frag. + * symbols.c (S_CAN_BE_REDEFINED): New function. + * symbols.h (S_CAN_BE_REDEFINED): Declare. + * read.c (assign_symbol): Use S_CAN_BE_REDEFINED. + 2011-10-12 Alan Modra * symbols.c (local_symbol_make): Make global. diff --git a/gas/as.c b/gas/as.c index 650c4f25435..b99ea1e8be6 100644 --- a/gas/as.c +++ b/gas/as.c @@ -1206,8 +1206,8 @@ main (int argc, char ** argv) dwarf2_init (); - local_symbol_make ("__GAS_VERSION__", absolute_section, - BFD_VERSION / 10000UL, &zero_address_frag); + local_symbol_make (".gasversion.", absolute_section, + BFD_VERSION / 10000UL, &predefined_address_frag); /* Now that we have fully initialized, and have created the output file, define any symbols requested by --defsym command line diff --git a/gas/frags.c b/gas/frags.c index fb3c02d3b5d..fe3e78f5744 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -25,7 +25,7 @@ #include "obstack.h" extern fragS zero_address_frag; -extern fragS bss_address_frag; +extern fragS predefined_address_frag; /* Initialization for frag routines. */ @@ -33,7 +33,7 @@ void frag_init (void) { zero_address_frag.fr_type = rs_fill; - bss_address_frag.fr_type = rs_fill; + predefined_address_frag.fr_type = rs_fill; } /* Check that we're not trying to assemble into a section that can't diff --git a/gas/frags.h b/gas/frags.h index 650ea5ed6a5..dd247f9c535 100644 --- a/gas/frags.h +++ b/gas/frags.h @@ -118,8 +118,7 @@ extern addressT frag_now_fix_octets (void); /* For foreign-segment symbol fixups. */ COMMON fragS zero_address_frag; -/* For local common (N_BSS segment) fixups. */ -COMMON fragS bss_address_frag; +COMMON fragS predefined_address_frag; extern void frag_append_1_char (int); #define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X) diff --git a/gas/read.c b/gas/read.c index 2ab58ecbc30..445caa1489d 100644 --- a/gas/read.c +++ b/gas/read.c @@ -3091,9 +3091,8 @@ assign_symbol (char *name, int mode) if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) { - /* Permit register names to be redefined. */ if ((mode != 0 || !S_IS_VOLATILE (symbolP)) - && S_GET_SEGMENT (symbolP) != reg_section) + && !S_CAN_BE_REDEFINED (symbolP)) { as_bad (_("symbol `%s' is already defined"), name); symbolP = symbol_clone (symbolP, 0); diff --git a/gas/symbols.c b/gas/symbols.c index b5d5a43b2f9..086e01d6a5b 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -2136,6 +2136,16 @@ S_IS_STABD (symbolS *s) return S_GET_NAME (s) == 0; } +int +S_CAN_BE_REDEFINED (const symbolS *s) +{ + if (LOCAL_SYMBOL_CHECK (s)) + return (local_symbol_get_frag ((struct local_symbol *) s) + == &predefined_address_frag); + /* Permit register names to be redefined. */ + return s->bsym->section == reg_section; +} + int S_IS_VOLATILE (const symbolS *s) { diff --git a/gas/symbols.h b/gas/symbols.h index 7c9896feb90..a3a31f765bc 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -100,6 +100,7 @@ extern int S_FORCE_RELOC (symbolS *, int); extern int S_IS_DEBUG (symbolS *); extern int S_IS_LOCAL (symbolS *); extern int S_IS_STABD (symbolS *); +extern int S_CAN_BE_REDEFINED (const symbolS *); extern int S_IS_VOLATILE (const symbolS *); extern int S_IS_FORWARD_REF (const symbolS *); extern const char *S_GET_NAME (symbolS *);