mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:39:20 +02:00
* 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:
parent
05cddddf7c
commit
9450beb99c
@ -87,6 +87,10 @@ type
|
|||||||
TOperand = class
|
TOperand = class
|
||||||
opr : TOprRec;
|
opr : TOprRec;
|
||||||
typesize : byte;
|
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 }
|
hastype, { if the operand has typecasted variable }
|
||||||
hasvar : boolean; { if the operand is loaded with a variable }
|
hasvar : boolean; { if the operand is loaded with a variable }
|
||||||
size : TCGSize;
|
size : TCGSize;
|
||||||
@ -636,6 +640,7 @@ end;
|
|||||||
constructor TOperand.Create;
|
constructor TOperand.Create;
|
||||||
begin
|
begin
|
||||||
size:=OS_NO;
|
size:=OS_NO;
|
||||||
|
hasproc:=false;
|
||||||
hastype:=false;
|
hastype:=false;
|
||||||
hasvar:=false;
|
hasvar:=false;
|
||||||
FillChar(Opr,sizeof(Opr),0);
|
FillChar(Opr,sizeof(Opr),0);
|
||||||
@ -964,6 +969,7 @@ Begin
|
|||||||
else
|
else
|
||||||
Message(asmr_e_invalid_operand_type);
|
Message(asmr_e_invalid_operand_type);
|
||||||
end;
|
end;
|
||||||
|
hasproc:=true;
|
||||||
hasvar:=true;
|
hasvar:=true;
|
||||||
SetupVar:=TRUE;
|
SetupVar:=TRUE;
|
||||||
Exit;
|
Exit;
|
||||||
@ -984,6 +990,7 @@ Begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
haslabelref:=true;
|
||||||
hasvar:=true;
|
hasvar:=true;
|
||||||
SetupVar:=TRUE;
|
SetupVar:=TRUE;
|
||||||
Exit;
|
Exit;
|
||||||
|
@ -2332,7 +2332,9 @@ Unit Rax86int;
|
|||||||
begin
|
begin
|
||||||
{ convert 'call/jmp [proc/label]' to 'call/jmp proc/label'. Ugly,
|
{ convert 'call/jmp [proc/label]' to 'call/jmp proc/label'. Ugly,
|
||||||
but Turbo Pascal 7 compatible. }
|
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
|
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
|
(ref.base=NR_NO) and (ref.index=NR_NO) then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user