From 0787a12d29ae23928602e975a49950bebc4fd0ed Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 4 May 2007 00:02:47 +0000 Subject: [PATCH] PR gas/4460 * config/tc-i386.c (lex_got): Don't replace the reloc token with a space if we already have a space. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.c | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index e77aa6c2038..b08a83672a0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2007-05-04 Alan Modra + + PR gas/4460 + * config/tc-i386.c (lex_got): Don't replace the reloc token with + a space if we already have a space. + 2007-05-03 H.J. Lu * config/tc-i386.c (match_template): Don't explicitly check diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index b96871fc2de..af278c0d86d 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4477,9 +4477,6 @@ lex_got (enum bfd_reloc_code_real *reloc, if (GOT_symbol == NULL) GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME); - /* Replace the relocation token with ' ', so that - errors like foo@GOTOFF1 will be detected. */ - /* The length of the first part of our input line. */ first = cp - input_line_pointer; @@ -4495,9 +4492,12 @@ lex_got (enum bfd_reloc_code_real *reloc, be necessary, but be safe. */ tmpbuf = xmalloc (first + second + 2); memcpy (tmpbuf, input_line_pointer, first); - tmpbuf[first] = ' '; - memcpy (tmpbuf + first + 1, past_reloc, second); - tmpbuf[first + second + 1] = '\0'; + if (second != 0 && *past_reloc != ' ') + /* Replace the relocation token with ' ', so that + errors like foo@GOTOFF1 will be detected. */ + tmpbuf[first++] = ' '; + memcpy (tmpbuf + first, past_reloc, second); + tmpbuf[first + second] = '\0'; return tmpbuf; } -- 2.30.2