Fix local label code to use LOCAL_LABEL_PREFIX
authorNick Clifton <nickc@redhat.com>
Thu, 11 Jan 2001 01:32:35 +0000 (01:32 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 11 Jan 2001 01:32:35 +0000 (01:32 +0000)
gas/ChangeLog
gas/symbols.c

index 12c316e..3555324 100644 (file)
@@ -1,3 +1,17 @@
+2001-01-10  Nick Clifton  <nickc@redhat.com>
+
+       * symbols.c (DOLLAR_LABEL_CHAR): New constant - the magic
+       character used to dollar local symbols.
+       (LOCAL_LABEL_CHAR): New constant - the magic character used to
+       local label symbols.
+       (dollar_label_name): Use DOLLAR_LABEL_CHAR.
+       (fb_label_name): Prefix local labels with LOCAL_LABEL_PREFIX,
+       if defined.
+       Use LOCAL_LABEL_CHAR.
+       (decode_local_label_name): Skip LOCAL_LABEL_PREFIX.
+       Use DOLLAR_LABEL_CHAR and LOCAL_LABEL_CHAR.
+       (S_IS_LOCAL): Use DOLLAR_LABEL_CHAR and LOCAL_LABEL_CHAR.
+
 2001-01-08  Bo Thorsen  <bo@suse.de>
 
         * config/tc-i386.c (i386_immediate, i386_displacement):
index a9dac42..a338df0 100644 (file)
@@ -55,6 +55,9 @@ symbolS abs_symbol;
 #define debug_verify_symchain(root, last) ((void) 0)
 #endif
 
+#define DOLLAR_LABEL_CHAR      '\001'
+#define LOCAL_LABEL_CHAR       '\002'
+
 struct obstack notes;
 
 static void fb_label_init PARAMS ((void));
@@ -1329,7 +1332,7 @@ dollar_label_name (n, augend)
   while ((*p = *--q) != '\0')
     ++p;
 
-  *p++ = 1;                    /* ^A  */
+  *p++ = DOLLAR_LABEL_CHAR;            /* ^A  */
 
   /* Instance number.  */
   q = symbol_name_temporary;
@@ -1483,6 +1486,9 @@ fb_label_name (n, augend)
   know (n >= 0);
   know (augend == 0 || augend == 1);
   p = symbol_name_build;
+#ifdef LOCAL_LABEL_PREFIX
+  *p++ = LOCAL_LABEL_PREFIX;
+#endif
   *p++ = 'L';
 
   /* Next code just does sprintf( {}, "%d", n);  */
@@ -1496,7 +1502,7 @@ fb_label_name (n, augend)
   while ((*p = *--q) != '\0')
     ++p;
 
-  *p++ = 2;                    /* ^B  */
+  *p++ = LOCAL_LABEL_CHAR;             /* ^B  */
 
   /* Instance number.  */
   q = symbol_name_temporary;
@@ -1525,16 +1531,22 @@ decode_local_label_name (s)
   int instance_number;
   char *type;
   const char *message_format = _("\"%d\" (instance number %d of a %s label)");
-
-  if (s[0] != 'L')
+  int index = 0;
+  
+#ifdef LOCAL_LABEL_PREFIX
+  if (s[index] == LOCAL_LABEL_PREFIX)
+    ++index;
+#endif
+  
+  if (s[index] != 'L')
     return s;
 
-  for (label_number = 0, p = s + 1; isdigit ((unsigned char) *p); ++p)
+  for (label_number = 0, p = s + index + 1; isdigit ((unsigned char) *p); ++p)
     label_number = (10 * label_number) + *p - '0';
 
-  if (*p == 1)
+  if (*p == DOLLAR_LABEL_CHAR)
     type = "dollar";
-  else if (*p == 2)
+  else if (*p == LOCAL_LABEL_CHAR)
     type = "fb";
   else
     return s;
@@ -1721,8 +1733,8 @@ S_IS_LOCAL (s)
   name = S_GET_NAME (s);
   return (name != NULL
          && ! S_IS_DEBUG (s)
-         && (strchr (name, '\001')
-             || strchr (name, '\002')
+         && (strchr (name, DOLLAR_LABEL_CHAR)
+             || strchr (name, LOCAL_LABEL_CHAR)
              || (! flag_keep_locals
                  && (bfd_is_local_label (stdoutput, s->bsym)
                      || (flag_mri