diff --git a/gas/ChangeLog b/gas/ChangeLog index 977bd04d6c..203e2c6135 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2000-12-15 Diego Novillo + + * config/tc-i386.c (intel_e09_1): Only flag as a memory operand if + it's not an offset expression. + (intel_e10_1): Ditto. Also, if the operand is an offset expression, + keep the braces '[' and ']' in the output string. + (intel_e11): Ditto. Also remove comparison intel_parser.op_modifier + != FLAT. There is no such op_modifier. + 2000-12-14 Michael Sokolov * dwarf2dbg.c: If we don't have , try including diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2315916c6f..8b0ab63147 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4588,7 +4588,10 @@ intel_e09_1 () /* e09 : e10 e09' */ else if (cur_token.code == ':') { - intel_parser.is_mem = 1; + /* Mark as a memory operand only if it's not already known to be an + offset expression. */ + if (intel_parser.op_modifier != OFFSET_FLAT) + intel_parser.is_mem = 1; return (intel_match_token (':') && intel_e10 () && intel_e09_1 ()); } @@ -4615,13 +4618,30 @@ intel_e10_1 () if (cur_token.code == '[') { intel_match_token ('['); - intel_parser.is_mem = 1; + + /* Mark as a memory operand only if it's not already known to be an + offset expression. If it's an offset expression, we need to keep + the brace in. */ + if (intel_parser.op_modifier != OFFSET_FLAT) + intel_parser.is_mem = 1; + else + strcat (intel_parser.disp, "["); /* Add a '+' to the displacement string if necessary. */ - if (*intel_parser.disp != '\0') + if (*intel_parser.disp != '\0' + && *(intel_parser.disp + strlen (intel_parser.disp) - 1) != '+') strcat (intel_parser.disp, "+"); - return (intel_expr () && intel_match_token (']') && intel_e10_1 ()); + if (intel_expr () && intel_match_token (']')) + { + /* Preserve brackets when the operand is an offset expression. */ + if (intel_parser.op_modifier == OFFSET_FLAT) + strcat (intel_parser.disp, "]"); + + return intel_e10_1 (); + } + else + return 0; } /* e10' Empty */ @@ -4663,7 +4683,14 @@ intel_e11 () else if (cur_token.code == '[') { intel_match_token ('['); - intel_parser.is_mem = 1; + + /* Mark as a memory operand only if it's not already known to be an + offset expression. If it's an offset expression, we need to keep + the brace in. */ + if (intel_parser.op_modifier != OFFSET_FLAT) + intel_parser.is_mem = 1; + else + strcat (intel_parser.disp, "["); /* Operands for jump/call inside brackets denote absolute addresses. */ if (current_templates->start->opcode_modifier & Jump @@ -4673,10 +4700,20 @@ intel_e11 () i.types[this_operand] |= JumpAbsolute; /* Add a '+' to the displacement string if necessary. */ - if (*intel_parser.disp != '\0') + if (*intel_parser.disp != '\0' + && *(intel_parser.disp + strlen (intel_parser.disp) - 1) != '+') strcat (intel_parser.disp, "+"); - return (intel_expr () && intel_match_token (']')); + if (intel_expr () && intel_match_token (']')) + { + /* Preserve brackets when the operand is an offset expression. */ + if (intel_parser.op_modifier == OFFSET_FLAT) + strcat (intel_parser.disp, "]"); + + return 1; + } + else + return 0; } /* e11 BYTE @@ -4701,7 +4738,11 @@ intel_e11 () { strcat (intel_parser.disp, cur_token.str); intel_match_token (cur_token.code); - intel_parser.is_mem = 1; + + /* Mark as a memory operand only if it's not already known to be an + offset expression. */ + if (intel_parser.op_modifier != OFFSET_FLAT) + intel_parser.is_mem = 1; return 1; } @@ -4832,8 +4873,7 @@ intel_e11 () /* The identifier represents a memory reference only if it's not preceded by an offset modifier. */ - if (intel_parser.op_modifier != OFFSET_FLAT - && intel_parser.op_modifier != FLAT) + if (intel_parser.op_modifier != OFFSET_FLAT) intel_parser.is_mem = 1; return 1;