aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2005-11-17 07:29:28 +0000
committerJan Beulich <jbeulich@novell.com>2005-11-17 07:29:28 +0000
commit92757bc91688685a680cc6c6cd03324b894c4501 (patch)
treeaf7f90015e9fa7a13331367da0e55c3fbe02b9b7 /gas/read.c
parent2be701a30fd949e7a486fcf6843fdb34f6bc00dc (diff)
downloadgdb-92757bc91688685a680cc6c6cd03324b894c4501.zip
gdb-92757bc91688685a680cc6c6cd03324b894c4501.tar.gz
gdb-92757bc91688685a680cc6c6cd03324b894c4501.tar.bz2
gas/
2005-11-17 Jan Beulich <jbeulich@novell.com> * symbols.h (S_CLEAR_VOLATILE): Declare. * symbols.c (colon): Also accept redefinable symbols for redefinition. Clone them before modifying. (S_CLEAR_VOLATILE): Define. * cond.c (s_ifdef): Also test for equated symbols. * read.c (s_comm_internal): Also exclude non-redefinable equated symbols. Clone redefinable ones before modifying. (s_weakref): Clone redefinable symbols before modifying. * doc/internals.texi: Document sy_volatile, sy_forward_ref, S_IS_VOLATILE, S_SET_VOLATILE, S_CLEAR_VOLATILE, S_IS_FORWARD_REF, and S_SET_FORWARD_REF. gas/testsuite/ 2005-11-17 Jan Beulich <jbeulich@novell.com> * gas/all/cond.s: Also check ifdef works on equates and commons. * gas/all/cond.l: Adjust. * gas/all/redef2.s: Also test redefining equate to label. * gas/all/redef2.d: Adjust. * gas/all/redef3.[sd]: New. * gas/all/redef4.s: New. * gas/all/redef5.s: New. * gas/elf/redef.s: New, copied from original gas/all/redef2.s. * gas/elf/redef.d: Remove #source. * gas/all/gas.exp: Remove exclusion of iq2000-*-* from and adjust xfails for redefinition tests. Run new tests. Exclude alpha*-*-*, mips*-*-*, *c54x*-*-* from weakref tests.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/gas/read.c b/gas/read.c
index 84ca9fa..0485d72 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1467,13 +1467,25 @@ s_comm_internal (int param,
*p = 0;
symbolP = symbol_find_or_make (name);
- if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
+ if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
+ && !S_IS_COMMON (symbolP))
{
- symbolP = NULL;
- as_bad (_("symbol `%s' is already defined"), name);
- *p = c;
- ignore_rest_of_line ();
- goto out;
+ if (!S_IS_VOLATILE (symbolP))
+ {
+ symbolP = NULL;
+ as_bad (_("symbol `%s' is already defined"), name);
+ *p = c;
+ ignore_rest_of_line ();
+ goto out;
+ }
+ /* This could be avoided when the symbol wasn't used so far, but
+ the comment in struc-symbol.h says this flag isn't reliable. */
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_SET_SEGMENT (symbolP, undefined_section);
+ S_SET_VALUE (symbolP, 0);
+ symbol_set_frag (symbolP, &zero_address_frag);
+ S_CLEAR_VOLATILE (symbolP);
}
size = S_GET_VALUE (symbolP);
@@ -3174,10 +3186,18 @@ s_weakref (int ignore ATTRIBUTE_UNUSED)
if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
{
- as_bad (_("symbol `%s' is already defined"), name);
- *end_name = delim;
- ignore_rest_of_line ();
- return;
+ if(!S_IS_VOLATILE (symbolP))
+ {
+ as_bad (_("symbol `%s' is already defined"), name);
+ *end_name = delim;
+ ignore_rest_of_line ();
+ return;
+ }
+ /* This could be avoided when the symbol wasn't used so far, but
+ the comment in struc-symbol.h says this flag isn't reliable. */
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_CLEAR_VOLATILE (symbolP);
}
*end_name = delim;