* config/tc-i386.c (i386_operand): Use alloca rather than a fixed

buffer size to make a copy of the symbol.
This commit is contained in:
Ian Lance Taylor
1997-06-16 17:31:46 +00:00
parent f4ae97e1bd
commit a52f90a4c8
2 changed files with 47 additions and 28 deletions

View File

@ -1,5 +1,8 @@
Mon Jun 16 12:45:56 1997 Ian Lance Taylor <ian@cygnus.com> Mon Jun 16 12:45:56 1997 Ian Lance Taylor <ian@cygnus.com>
* config/tc-i386.c (i386_operand): Use alloca rather than a fixed
buffer size to make a copy of the symbol.
* Makefile.in (OBJS): Put @extra_objects@ on the same line as * Makefile.in (OBJS): Put @extra_objects@ on the same line as
macro.o. macro.o.

View File

@ -638,7 +638,8 @@ pi (line, x)
fprintf (stdout, " #%d: ", i + 1); fprintf (stdout, " #%d: ", i + 1);
pt (x->types[i]); pt (x->types[i]);
fprintf (stdout, "\n"); fprintf (stdout, "\n");
if (x->types[i] & (Reg | SReg2 | SReg3 | Control | Debug | Test)) if (x->types[i]
& (Reg | SReg2 | SReg3 | Control | Debug | Test | RegMMX))
fprintf (stdout, "%s\n", x->regs[i]->reg_name); fprintf (stdout, "%s\n", x->regs[i]->reg_name);
if (x->types[i] & Imm) if (x->types[i] & Imm)
pe (x->imms[i]); pe (x->imms[i]);
@ -2329,6 +2330,7 @@ i386_operand (operand_string)
save_input_line_pointer = input_line_pointer; save_input_line_pointer = input_line_pointer;
input_line_pointer = displacement_string_start; input_line_pointer = displacement_string_start;
END_STRING_AND_SAVE (displacement_string_end); END_STRING_AND_SAVE (displacement_string_end);
#ifndef LEX_AT #ifndef LEX_AT
{ {
/* /*
@ -2338,36 +2340,49 @@ i386_operand (operand_string)
* into a temporary buffer... * into a temporary buffer...
*/ */
register char *cp; register char *cp;
if ((cp = strchr (input_line_pointer,'@')) != NULL) {
char tmpbuf[BUFSIZ];
if(!GOT_symbol) cp = strchr (input_line_pointer, '@');
if (cp != NULL)
{
char *tmpbuf;
if (GOT_symbol == NULL)
GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME); GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
if (strncmp(cp+1, "PLT", 3) == 0) { tmpbuf = (char *) alloca ((cp - input_line_pointer) + 20);
if (strncmp (cp + 1, "PLT", 3) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32; i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
*cp = '\0'; *cp = '\0';
strcpy (tmpbuf, input_line_pointer); strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 3); strcat (tmpbuf, cp + 1 + 3);
*cp = '@'; *cp = '@';
} else if (strncmp(cp+1, "GOTOFF", 6) == 0) { }
else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF; i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
*cp = '\0'; *cp = '\0';
strcpy (tmpbuf, input_line_pointer); strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 6); strcat (tmpbuf, cp + 1 + 6);
*cp = '@'; *cp = '@';
} else if (strncmp(cp+1, "GOT", 3) == 0) { }
else if (strncmp (cp + 1, "GOT", 3) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32; i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
*cp = '\0'; *cp = '\0';
strcpy (tmpbuf, input_line_pointer); strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 3); strcat (tmpbuf, cp + 1 + 3);
*cp = '@'; *cp = '@';
} else }
else
as_bad ("Bad reloc specifier '%s' in expression", cp + 1); as_bad ("Bad reloc specifier '%s' in expression", cp + 1);
input_line_pointer = tmpbuf; input_line_pointer = tmpbuf;
} }
} }
#endif #endif
exp_seg = expression (exp); exp_seg = expression (exp);
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
@ -3054,6 +3069,7 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_386_GOT32: case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_GOTOFF: case BFD_RELOC_386_GOTOFF:
case BFD_RELOC_386_GOTPC: case BFD_RELOC_386_GOTPC:
case BFD_RELOC_RVA:
code = fixp->fx_r_type; code = fixp->fx_r_type;
break; break;
default: default: