Deleted Added
full compact
2c2,3
< Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation.
---
> Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 1998
> Free Software Foundation.
108c109
< /* RM and IB are the modrm byte and the base index byte where the
---
> /* RM and BI are the modrm byte and the base index byte where the
305c306
< {0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */
---
> {0x8d,0xb4,0x00,0x00}; /* lea 0w(%si),%si */
308c309
< 0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */
---
> 0x8d,0xb4,0x00,0x00}; /* lea 0w(%si),%si */
313c314
< {0x8d,0x76,0x00, /* lea 0(%si),%si */
---
> {0x8d,0x74,0x00, /* lea 0(%si),%si */
316c317
< {0x8d,0xb6,0x00,0x00, /* lea 0w(%si),%si */
---
> {0x8d,0xb4,0x00,0x00, /* lea 0w(%si),%si */
436c437
< #ifndef OBJ_AOUT
---
> #if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
805c806
< #ifndef OBJ_AOUT
---
> #ifdef OBJ_ELF
836,837c837,838
< /* Holds template once we've found it. */
< template *t;
---
> /* Points to template once we've found it. */
> const template *t;
846a848,852
> /* Wait prefix needs to come before any other prefixes, so handle it
> specially. wait_prefix will hold the opcode modifier flag FWait
> if a wait prefix is given. */
> int wait_prefix = 0;
>
855c861
< /* Fist parse an opcode & call i386_operand for the operands.
---
> /* First parse an opcode & call i386_operand for the operands.
907c913
< if (i.prefixes == MAX_PREFIXES)
---
> if (prefix->prefix_code == FWAIT_OPCODE)
909,910c915,920
< as_bad ("too many opcode prefixes");
< return;
---
> if (wait_prefix != 0)
> {
> as_bad ("same prefix used twice; you don't really want this!");
> return;
> }
> wait_prefix = FWait;
912,914c922,933
< i.prefix[i.prefixes++] = prefix->prefix_code;
< if (prefix->prefix_code == REPE || prefix->prefix_code == REPNE)
< expecting_string_instruction = 1;
---
> else
> {
> if (i.prefixes == MAX_PREFIXES)
> {
> as_bad ("too many opcode prefixes");
> return;
> }
> i.prefix[i.prefixes++] = prefix->prefix_code;
> if (prefix->prefix_code == REPE
> || prefix->prefix_code == REPNE)
> expecting_string_instruction = 1;
> }
1134,1135c1153,1154
< t->operand_types[0],
< t->operand_types[1]))
---
> t->operand_types[1],
> t->operand_types[0]))
1168c1187
< /* Copy the template we found (we may change it!). */
---
> /* Copy the template we found. */
1170c1189
< t = &i.tm; /* alter new copy of template */
---
> i.tm.opcode_modifier |= wait_prefix;
1171a1191,1196
> if (found_reverse_match)
> {
> i.tm.operand_types[0] = t->operand_types[1];
> i.tm.operand_types[1] = t->operand_types[0];
> }
>
1174c1199
< if (t->opcode_modifier & (Data16|Data32))
---
> if (i.tm.opcode_modifier & (Data16|Data32))
1181c1206
< if (t->opcode_modifier & Data16)
---
> if (i.tm.opcode_modifier & Data16)
1278,1285d1302
< if (found_reverse_match)
< {
< unsigned int save;
< save = t->operand_types[0];
< t->operand_types[0] = t->operand_types[1];
< t->operand_types[1] = save;
< }
<
1290c1307
< if (!i.suffix && (t->opcode_modifier & W))
---
> if (!i.suffix && (i.tm.opcode_modifier & W))
1299,1300c1316,1317
< if (t->opcode_modifier & W)
< t->base_opcode |= W;
---
> if (i.tm.opcode_modifier & W)
> i.tm.base_opcode |= W;
1307c1324
< as_bad ("%d prefixes given and 'w' opcode suffix gives too many prefixes",
---
> as_bad ("%d prefixes given and data size prefix gives too many prefixes",
1334c1351
< t->base_opcode |= found_reverse_match;
---
> i.tm.base_opcode |= found_reverse_match;
1339c1356
< if (t->opcode_modifier & imulKludge)
---
> if (i.tm.opcode_modifier & imulKludge)
1347c1364
< if (t->opcode_modifier & iclrKludge)
---
> if (i.tm.opcode_modifier & iclrKludge)
1358c1375
< if ((t->opcode_modifier & ReverseRegRegmem) && i.reg_operands == 2)
---
> if ((i.tm.opcode_modifier & ReverseRegRegmem) && i.reg_operands == 2)
1367c1384
< if (t->opcode_modifier & ShortForm)
---
> if (i.tm.opcode_modifier & ShortForm)
1372c1389
< t->base_opcode |= i.regs[op]->reg_num;
---
> i.tm.base_opcode |= i.regs[op]->reg_num;
1374c1391
< else if (t->opcode_modifier & ShortFormW)
---
> else if (i.tm.opcode_modifier & ShortFormW)
1377c1394
< t->base_opcode |= i.regs[1]->reg_num;
---
> i.tm.base_opcode |= i.regs[1]->reg_num;
1380c1397
< t->base_opcode |= 0x8;
---
> i.tm.base_opcode |= 0x8;
1382c1399
< else if (t->opcode_modifier & Seg2ShortForm)
---
> else if (i.tm.opcode_modifier & Seg2ShortForm)
1384c1401
< if (t->base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1)
---
> if (i.tm.base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1)
1389c1406
< t->base_opcode |= (i.regs[0]->reg_num << 3);
---
> i.tm.base_opcode |= (i.regs[0]->reg_num << 3);
1391c1408
< else if (t->opcode_modifier & Seg3ShortForm)
---
> else if (i.tm.opcode_modifier & Seg3ShortForm)
1398c1415
< t->base_opcode |= 0x08;
---
> i.tm.base_opcode |= 0x08;
1400c1417
< else if ((t->base_opcode & ~DW) == MOV_AX_DISP32)
---
> else if ((i.tm.base_opcode & ~DW) == MOV_AX_DISP32)
1408c1425
< else if (t->opcode_modifier & Modrm)
---
> else if (i.tm.opcode_modifier & Modrm)
1410,1413c1427,1430
< /* The opcode is completed (modulo t->extension_opcode which must
< be put into the modrm byte.
< Now, we make the modrm & index base bytes based on all the info
< we've collected. */
---
> /* The opcode is completed (modulo i.tm.extension_opcode which
> must be put into the modrm byte).
> Now, we make the modrm & index base bytes based on all the
> info we've collected. */
1565,1568c1582,1585
< operand (if any) based on
< t->extension_opcode. Again, we must be careful to
< make sure that segment/control/debug/test/MMX
< registers are coded into the i.rm.reg field. */
---
> operand (if any) based on i.tm.extension_opcode.
> Again, we must be careful to make sure that
> segment/control/debug/test/MMX registers are coded
> into the i.rm.reg field. */
1583c1600
< if (t->extension_opcode != None)
---
> if (i.tm.extension_opcode != None)
1596,1597c1613,1614
< if (t->extension_opcode != None)
< i.rm.reg = t->extension_opcode;
---
> if (i.tm.extension_opcode != None)
> i.rm.reg = i.tm.extension_opcode;
1638c1655
< if (t->base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3)
---
> if (i.tm.base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3)
1640c1657
< t->base_opcode = INT3_OPCODE;
---
> i.tm.base_opcode = INT3_OPCODE;
1649c1666
< if (t->opcode_modifier & Jump)
---
> if (i.tm.opcode_modifier & Jump)
1659c1676
< p[0] = t->base_opcode;
---
> p[0] = i.tm.base_opcode;
1676c1693
< if (t->base_opcode == JUMP_PC_RELATIVE)
---
> if (i.tm.base_opcode == JUMP_PC_RELATIVE)
1690c1707
< p[1] = t->base_opcode + 0x10;
---
> p[1] = i.tm.base_opcode + 0x10;
1709c1726
< p[0] = t->base_opcode;
---
> p[0] = i.tm.base_opcode;
1720c1737
< else if (t->opcode_modifier & (JumpByte | JumpDword))
---
> else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
1722c1739
< int size = (t->opcode_modifier & JumpByte) ? 1 : 4;
---
> int size = (i.tm.opcode_modifier & JumpByte) ? 1 : 4;
1731c1748,1770
< FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
---
> /* The jcxz/jecxz instructions are marked with Data16
> and Data32, which means that they may get
> WORD_PREFIX_OPCODE added to the list of prefixes.
> However, the are correctly distinguished using
> ADDR_PREFIX_OPCODE. Here we look for
> WORD_PREFIX_OPCODE, and actually emit
> ADDR_PREFIX_OPCODE. This is a hack, but, then, so
> is the instruction itself.
>
> If an explicit suffix is used for the loop
> instruction, that actually controls whether we use
> cx vs. ecx. This is also controlled by
> ADDR_PREFIX_OPCODE.
>
> I don't know if there is any valid case in which we
> want to emit WORD_PREFIX_OPCODE, but I am keeping
> the old behaviour for safety. */
>
> if (IS_JUMP_ON_CX_ZERO (i.tm.base_opcode)
> || IS_LOOP_ECX_TIMES (i.tm.base_opcode))
> FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE);
> else
> FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
1743c1782
< if (fits_in_unsigned_byte (t->base_opcode))
---
> if (fits_in_unsigned_byte (i.tm.base_opcode))
1745c1784
< FRAG_APPEND_1_CHAR (t->base_opcode);
---
> FRAG_APPEND_1_CHAR (i.tm.base_opcode);
1753,1754c1792,1793
< *p++ = (t->base_opcode >> 8) & 0xff;
< *p = t->base_opcode & 0xff;
---
> *p++ = (i.tm.base_opcode >> 8) & 0xff;
> *p = i.tm.base_opcode & 0xff;
1775c1814
< else if (t->opcode_modifier & JumpInterSegment)
---
> else if (i.tm.opcode_modifier & JumpInterSegment)
1785c1824
< p[0] = t->base_opcode;
---
> p[0] = i.tm.base_opcode;
1800c1839,1848
< /* First the prefix bytes. */
---
> /* Hack for fwait. It must come before any prefixes, as it
> really is an instruction rather than a prefix. */
> if ((i.tm.opcode_modifier & FWait) != 0)
> {
> p = frag_more (1);
> insn_size += 1;
> md_number_to_chars (p, (valueT) FWAIT_OPCODE, 1);
> }
>
> /* The prefix bytes. */
1809c1857
< if (fits_in_unsigned_byte (t->base_opcode))
---
> if (fits_in_unsigned_byte (i.tm.base_opcode))
1811c1859
< FRAG_APPEND_1_CHAR (t->base_opcode);
---
> FRAG_APPEND_1_CHAR (i.tm.base_opcode);
1814c1862
< else if (fits_in_unsigned_word (t->base_opcode))
---
> else if (fits_in_unsigned_word (i.tm.base_opcode))
1819,1820c1867,1868
< *p++ = (t->base_opcode >> 8) & 0xff;
< *p = t->base_opcode & 0xff;
---
> *p++ = (i.tm.base_opcode >> 8) & 0xff;
> *p = i.tm.base_opcode & 0xff;
1824c1872
< if (t->base_opcode & 0xff000000)
---
> if (i.tm.base_opcode & 0xff000000)
1828c1876
< *p++ = (t->base_opcode >> 24) & 0xff;
---
> *p++ = (i.tm.base_opcode >> 24) & 0xff;
1835,1837c1883,1885
< *p++ = (t->base_opcode >> 16) & 0xff;
< *p++ = (t->base_opcode >> 8) & 0xff;
< *p = (t->base_opcode) & 0xff;
---
> *p++ = (i.tm.base_opcode >> 16) & 0xff;
> *p++ = (i.tm.base_opcode >> 8) & 0xff;
> *p = (i.tm.base_opcode) & 0xff;
1841c1889
< if (t->opcode_modifier & Modrm)
---
> if (i.tm.opcode_modifier & Modrm)
2092a2141,2150
> if (*input_line_pointer != '\0')
> {
> /* This should be as_bad, but some versions of gcc, up to
> about 2.8 and egcs 1.01, generate a bogus @GOTOFF(%ebx)
> in certain cases. Oddly, the code in question turns out
> to work correctly anyhow, so we make this just a warning
> until those versions of gcc are obsolete. */
> as_warn ("warning: unrecognized characters `%s' in expression",
> input_line_pointer);
> }
2162c2220
< no opcode suffix implies general memory references. */
---
> no opcode suffix implies general memory references. */
2332a2391
>
2342,2346d2400
< if ((cp = strchr (input_line_pointer,'@')) != NULL) {
< char tmpbuf[BUFSIZ];
<
< if(!GOT_symbol)
< GOT_symbol = symbol_find_or_make(GLOBAL_OFFSET_TABLE_NAME);
2348,2369c2402,2440
< if (strncmp(cp+1, "PLT", 3) == 0) {
< i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
< *cp = '\0';
< strcpy(tmpbuf, input_line_pointer);
< strcat(tmpbuf, cp+1+3);
< *cp = '@';
< } else if (strncmp(cp+1, "GOTOFF", 6) == 0) {
< i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
< *cp = '\0';
< strcpy(tmpbuf, input_line_pointer);
< strcat(tmpbuf, cp+1+6);
< *cp = '@';
< } else if (strncmp(cp+1, "GOT", 3) == 0) {
< i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
< *cp = '\0';
< strcpy(tmpbuf, input_line_pointer);
< strcat(tmpbuf, cp+1+3);
< *cp = '@';
< } else
< as_bad("Bad reloc specifier '%s' in expression", cp+1);
< input_line_pointer = tmpbuf;
< }
---
> cp = strchr (input_line_pointer, '@');
> if (cp != NULL)
> {
> char *tmpbuf;
>
> if (GOT_symbol == NULL)
> GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
>
> tmpbuf = (char *) alloca ((cp - input_line_pointer) + 20);
>
> if (strncmp (cp + 1, "PLT", 3) == 0)
> {
> i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
> *cp = '\0';
> strcpy (tmpbuf, input_line_pointer);
> strcat (tmpbuf, cp + 1 + 3);
> *cp = '@';
> }
> else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
> {
> i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
> *cp = '\0';
> strcpy (tmpbuf, input_line_pointer);
> strcat (tmpbuf, cp + 1 + 6);
> *cp = '@';
> }
> else if (strncmp (cp + 1, "GOT", 3) == 0)
> {
> i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
> *cp = '\0';
> strcpy (tmpbuf, input_line_pointer);
> strcat (tmpbuf, cp + 1 + 3);
> *cp = '@';
> }
> else
> as_bad ("Bad reloc specifier '%s' in expression", cp + 1);
>
> input_line_pointer = tmpbuf;
> }
2371a2443
>
2685a2758,2760
> if (fixP->fx_r_type == BFD_RELOC_32 && fixP->fx_pcrel)
> fixP->fx_r_type = BFD_RELOC_32_PCREL;
>
2694c2769,2770
< if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
---
> if (OUTPUT_FLAVOR == bfd_target_elf_flavour
> || OUTPUT_FLAVOR == bfd_target_coff_flavour)
2708a2785,2790
> #if defined (OBJ_COFF) && defined (TE_PE)
> /* For some reason, the PE format does not store a section
> address offset for a PC relative symbol. */
> if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
> value += md_pcrel_from (fixP);
> #endif
3057a3140
> case BFD_RELOC_RVA: