From aa257fcdbd8bc5816be8bebb39d05dba68de0c95 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 11 Jan 2001 01:32:35 +0000 Subject: [PATCH] Fix local label code to use LOCAL_LABEL_PREFIX --- gas/ChangeLog | 14 ++++++++++++++ gas/symbols.c | 30 +++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 12c316e206d..3555324e6ef 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,17 @@ +2001-01-10 Nick Clifton + + * 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 * config/tc-i386.c (i386_immediate, i386_displacement): diff --git a/gas/symbols.c b/gas/symbols.c index a9dac42f316..a338df079a2 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -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 -- 2.30.2