* fixed bug in intel syntax i8086 inline asm, when certain 'jmp/call [v]'

instructions got erroneously converted to 'jmp/call v', if 'v' is an external
  far variable that points to certain things (like a local label, exported via
  public)

git-svn-id: trunk@37538 -
This commit is contained in:
nickysn 2017-10-31 16:49:38 +00:00
parent 05cddddf7c
commit 9450beb99c
2 changed files with 10 additions and 1 deletions

View File

@ -87,6 +87,10 @@ type
TOperand = class
opr : TOprRec;
typesize : byte;
haslabelref, { if the operand has a label, used in a reference like a
var (e.g. 'mov ax, word ptr [label+5]', but *not*
e.g. 'jmp label') }
hasproc, { if the operand has a procedure/function reference }
hastype, { if the operand has typecasted variable }
hasvar : boolean; { if the operand is loaded with a variable }
size : TCGSize;
@ -636,6 +640,7 @@ end;
constructor TOperand.Create;
begin
size:=OS_NO;
hasproc:=false;
hastype:=false;
hasvar:=false;
FillChar(Opr,sizeof(Opr),0);
@ -964,6 +969,7 @@ Begin
else
Message(asmr_e_invalid_operand_type);
end;
hasproc:=true;
hasvar:=true;
SetupVar:=TRUE;
Exit;
@ -984,6 +990,7 @@ Begin
exit;
end;
end;
haslabelref:=true;
hasvar:=true;
SetupVar:=TRUE;
Exit;

View File

@ -2332,7 +2332,9 @@ Unit Rax86int;
begin
{ convert 'call/jmp [proc/label]' to 'call/jmp proc/label'. Ugly,
but Turbo Pascal 7 compatible. }
if (instr.opcode in [A_CALL,A_JMP]) and (typ=OPR_REFERENCE) and
if (instr.opcode in [A_CALL,A_JMP]) and
(instr.operands[i].haslabelref or instr.operands[i].hasproc)
and (typ=OPR_REFERENCE) and
assigned(ref.symbol) and (ref.symbol.typ in [AT_FUNCTION,AT_LABEL,AT_ADDR]) and
(ref.base=NR_NO) and (ref.index=NR_NO) then
begin