mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 20:11:19 +02:00
* reset insentry/lastinsoffset so writing smartlink works correct for
short jmps
This commit is contained in:
parent
3d9b33b0d0
commit
063ec648ca
@ -432,7 +432,11 @@ unit ag386bin;
|
|||||||
ait_string :
|
ait_string :
|
||||||
objectalloc^.sectionalloc(pai_string(hp)^.len);
|
objectalloc^.sectionalloc(pai_string(hp)^.len);
|
||||||
ait_instruction :
|
ait_instruction :
|
||||||
objectalloc^.sectionalloc(paicpu(hp)^.Pass1(objectalloc^.sectionsize));
|
begin
|
||||||
|
{ reset instructions which could change in pass 2 }
|
||||||
|
paicpu(hp)^.resetpass2;
|
||||||
|
objectalloc^.sectionalloc(paicpu(hp)^.Pass1(objectalloc^.sectionsize));
|
||||||
|
end;
|
||||||
ait_cut :
|
ait_cut :
|
||||||
if SmartAsm then
|
if SmartAsm then
|
||||||
begin
|
begin
|
||||||
@ -928,7 +932,11 @@ unit ag386bin;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.31 1999-12-22 01:01:46 peter
|
Revision 1.32 1999-12-24 15:22:52 peter
|
||||||
|
* reset insentry/lastinsoffset so writing smartlink works correct for
|
||||||
|
short jmps
|
||||||
|
|
||||||
|
Revision 1.31 1999/12/22 01:01:46 peter
|
||||||
- removed freelabel()
|
- removed freelabel()
|
||||||
* added undefined label detection in internal assembler, this prevents
|
* added undefined label detection in internal assembler, this prevents
|
||||||
a lot of ld crashes and wrong .o files
|
a lot of ld crashes and wrong .o files
|
||||||
|
@ -120,14 +120,16 @@ type
|
|||||||
procedure init(op : tasmop;_size : topsize); { this need to be called by all constructor }
|
procedure init(op : tasmop;_size : topsize); { this need to be called by all constructor }
|
||||||
{$ifndef NOAG386BIN}
|
{$ifndef NOAG386BIN}
|
||||||
public
|
public
|
||||||
|
{ the next will reset all instructions that can change in pass 2 }
|
||||||
|
procedure ResetPass2;
|
||||||
function Pass1(offset:longint):longint;virtual;
|
function Pass1(offset:longint):longint;virtual;
|
||||||
procedure Pass2;virtual;
|
procedure Pass2;virtual;
|
||||||
private
|
private
|
||||||
{ next fields are filled in pass1, so pass2 is faster }
|
{ next fields are filled in pass1, so pass2 is faster }
|
||||||
insentry : PInsEntry;
|
insentry : PInsEntry;
|
||||||
LastInsOffset,
|
|
||||||
insoffset,
|
insoffset,
|
||||||
inssize : longint;
|
inssize : longint;
|
||||||
|
LastInsOffset : longint; { need to be public to be reset }
|
||||||
function InsEnd:longint;
|
function InsEnd:longint;
|
||||||
procedure create_ot;
|
procedure create_ot;
|
||||||
function Matches(p:PInsEntry):longint;
|
function Matches(p:PInsEntry):longint;
|
||||||
@ -683,7 +685,7 @@ begin
|
|||||||
if assigned(sym) then
|
if assigned(sym) then
|
||||||
inc(l,sym^.address);
|
inc(l,sym^.address);
|
||||||
{ instruction size will then always become 2 (PFV) }
|
{ instruction size will then always become 2 (PFV) }
|
||||||
relsize:=InsOffset+2-l;
|
relsize:=(InsOffset+2)-l;
|
||||||
if (not assigned(sym) or
|
if (not assigned(sym) or
|
||||||
((sym^.typ<>AS_EXTERNAL) and (sym^.address<>0))) and
|
((sym^.typ<>AS_EXTERNAL) and (sym^.address<>0))) and
|
||||||
(relsize>=-128) and (relsize<=127) then
|
(relsize>=-128) and (relsize<=127) then
|
||||||
@ -799,6 +801,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure taicpu.ResetPass2;
|
||||||
|
begin
|
||||||
|
{ we are here in a second pass, check if the instruction can be optimized }
|
||||||
|
if assigned(InsEntry) and
|
||||||
|
((InsEntry^.flags and IF_PASS2)<>0) then
|
||||||
|
begin
|
||||||
|
InsEntry:=nil;
|
||||||
|
InsSize:=-1;
|
||||||
|
end;
|
||||||
|
LastInsOffset:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function taicpu.Pass1(offset:longint):longint;
|
function taicpu.Pass1(offset:longint):longint;
|
||||||
var
|
var
|
||||||
m,i : longint;
|
m,i : longint;
|
||||||
@ -1527,7 +1542,11 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 1999-11-30 10:40:43 peter
|
Revision 1.7 1999-12-24 15:22:52 peter
|
||||||
|
* reset insentry/lastinsoffset so writing smartlink works correct for
|
||||||
|
short jmps
|
||||||
|
|
||||||
|
Revision 1.6 1999/11/30 10:40:43 peter
|
||||||
+ ttype, tsymlist
|
+ ttype, tsymlist
|
||||||
|
|
||||||
Revision 1.5 1999/11/06 14:34:20 peter
|
Revision 1.5 1999/11/06 14:34:20 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user