mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-13 06:59:28 +01:00
* fix for jmps to be always near
* string writing fixed
This commit is contained in:
parent
8a6774104d
commit
1163717044
@ -50,7 +50,7 @@ unit ag386nsm;
|
|||||||
;
|
;
|
||||||
|
|
||||||
const
|
const
|
||||||
line_length = 70;
|
line_length = 64;
|
||||||
|
|
||||||
{$ifdef EXTTYPE}
|
{$ifdef EXTTYPE}
|
||||||
extstr : array[EXT_NEAR..EXT_ABS] of String[8] =
|
extstr : array[EXT_NEAR..EXT_ABS] of String[8] =
|
||||||
@ -270,7 +270,7 @@ unit ag386nsm;
|
|||||||
else
|
else
|
||||||
if o.symofs<0 then
|
if o.symofs<0 then
|
||||||
hs:=hs+tostr(o.symofs);
|
hs:=hs+tostr(o.symofs);
|
||||||
getopstr_jmp:=hs;
|
getopstr_jmp:='NEAR '+hs;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
internalerror(10001);
|
internalerror(10001);
|
||||||
@ -352,7 +352,8 @@ unit ag386nsm;
|
|||||||
tostr(paitempalloc(hp)^.tempsize)+allocstr[paitempalloc(hp)^.allocation]);
|
tostr(paitempalloc(hp)^.tempsize)+allocstr[paitempalloc(hp)^.allocation]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_section : begin
|
ait_section :
|
||||||
|
begin
|
||||||
if pai_section(hp)^.sec<>sec_none then
|
if pai_section(hp)^.sec<>sec_none then
|
||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
@ -360,15 +361,25 @@ unit ag386nsm;
|
|||||||
end;
|
end;
|
||||||
LastSec:=pai_section(hp)^.sec;
|
LastSec:=pai_section(hp)^.sec;
|
||||||
end;
|
end;
|
||||||
ait_align : AsmWriteLn(#9'ALIGN '+tostr(pai_align(hp)^.aligntype));
|
|
||||||
ait_datablock : begin
|
ait_align :
|
||||||
|
AsmWriteLn(#9'ALIGN '+tostr(pai_align(hp)^.aligntype));
|
||||||
|
|
||||||
|
ait_datablock :
|
||||||
|
begin
|
||||||
if pai_datablock(hp)^.is_global then
|
if pai_datablock(hp)^.is_global then
|
||||||
AsmWriteLn(#9'GLOBAL '+pai_datablock(hp)^.sym^.name);
|
begin
|
||||||
AsmWriteLn(PadTabs(pai_datablock(hp)^.sym^.name,':')+'RESB'#9+tostr(pai_datablock(hp)^.size));
|
AsmWrite(#9'GLOBAL ');
|
||||||
|
AsmWriteLn(pai_datablock(hp)^.sym^.name);
|
||||||
end;
|
end;
|
||||||
|
AsmWrite(PadTabs(pai_datablock(hp)^.sym^.name,':'));
|
||||||
|
AsmWriteLn('RESB'#9+tostr(pai_datablock(hp)^.size));
|
||||||
|
end;
|
||||||
|
|
||||||
ait_const_32bit,
|
ait_const_32bit,
|
||||||
ait_const_8bit,
|
ait_const_16bit,
|
||||||
ait_const_16bit : begin
|
ait_const_8bit :
|
||||||
|
begin
|
||||||
AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
|
AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
|
||||||
consttyp:=hp^.typ;
|
consttyp:=hp^.typ;
|
||||||
l:=0;
|
l:=0;
|
||||||
@ -384,22 +395,38 @@ unit ag386nsm;
|
|||||||
until (not found) or (l>line_length);
|
until (not found) or (l>line_length);
|
||||||
AsmLn;
|
AsmLn;
|
||||||
end;
|
end;
|
||||||
ait_const_symbol : begin
|
|
||||||
AsmWriteLn(#9#9'DD'#9+pai_const_symbol(hp)^.sym^.name);
|
ait_const_symbol :
|
||||||
|
begin
|
||||||
|
AsmWrite(#9#9'DD'#9);
|
||||||
|
AsmWrite(pai_const_symbol(hp)^.sym^.name);
|
||||||
if pai_const_symbol(hp)^.offset>0 then
|
if pai_const_symbol(hp)^.offset>0 then
|
||||||
AsmWrite('+'+tostr(pai_const_symbol(hp)^.offset))
|
AsmWrite('+'+tostr(pai_const_symbol(hp)^.offset))
|
||||||
else if pai_const_symbol(hp)^.offset<0 then
|
else if pai_const_symbol(hp)^.offset<0 then
|
||||||
AsmWrite(tostr(pai_const_symbol(hp)^.offset));
|
AsmWrite(tostr(pai_const_symbol(hp)^.offset));
|
||||||
AsmLn;
|
AsmLn;
|
||||||
end;
|
end;
|
||||||
ait_const_rva : begin
|
|
||||||
AsmWriteLn(#9#9'RVA'#9+pai_const_symbol(hp)^.sym^.name);
|
ait_const_rva :
|
||||||
|
begin
|
||||||
|
AsmWrite(#9#9'RVA'#9);
|
||||||
|
AsmWriteLn(pai_const_symbol(hp)^.sym^.name);
|
||||||
end;
|
end;
|
||||||
ait_real_32bit : AsmWriteLn(#9#9'DD'#9+single2str(pai_real_32bit(hp)^.value));
|
|
||||||
ait_real_64bit : AsmWriteLn(#9#9'DQ'#9+double2str(pai_real_64bit(hp)^.value));
|
ait_real_32bit :
|
||||||
ait_real_80bit : AsmWriteLn(#9#9'DT'#9+extended2str(pai_real_80bit(hp)^.value));
|
AsmWriteLn(#9#9'DD'#9+single2str(pai_real_32bit(hp)^.value));
|
||||||
ait_comp_64bit : AsmWriteLn(#9#9'DQ'#9+comp2str(pai_real_80bit(hp)^.value));
|
|
||||||
ait_string : begin
|
ait_real_64bit :
|
||||||
|
AsmWriteLn(#9#9'DQ'#9+double2str(pai_real_64bit(hp)^.value));
|
||||||
|
|
||||||
|
ait_real_80bit :
|
||||||
|
AsmWriteLn(#9#9'DT'#9+extended2str(pai_real_80bit(hp)^.value));
|
||||||
|
|
||||||
|
ait_comp_64bit :
|
||||||
|
AsmWriteLn(#9#9'DQ'#9+comp2str(pai_real_80bit(hp)^.value));
|
||||||
|
|
||||||
|
ait_string :
|
||||||
|
begin
|
||||||
counter := 0;
|
counter := 0;
|
||||||
lines := pai_string(hp)^.len div line_length;
|
lines := pai_string(hp)^.len div line_length;
|
||||||
{ separate lines in different parts }
|
{ separate lines in different parts }
|
||||||
@ -409,7 +436,7 @@ unit ag386nsm;
|
|||||||
begin
|
begin
|
||||||
AsmWrite(#9#9'DB'#9);
|
AsmWrite(#9#9'DB'#9);
|
||||||
quoted:=false;
|
quoted:=false;
|
||||||
for i:=counter to counter+line_length do
|
for i:=counter to counter+line_length-1 do
|
||||||
begin
|
begin
|
||||||
{ it is an ascii character. }
|
{ it is an ascii character. }
|
||||||
if (ord(pai_string(hp)^.str[i])>31) and
|
if (ord(pai_string(hp)^.str[i])>31) and
|
||||||
@ -437,7 +464,7 @@ unit ag386nsm;
|
|||||||
end; { end for i:=0 to... }
|
end; { end for i:=0 to... }
|
||||||
if quoted then AsmWrite('"');
|
if quoted then AsmWrite('"');
|
||||||
AsmWrite(target_os.newline);
|
AsmWrite(target_os.newline);
|
||||||
counter := counter+line_length;
|
inc(counter,line_length);
|
||||||
end; { end for j:=0 ... }
|
end; { end for j:=0 ... }
|
||||||
{ do last line of lines }
|
{ do last line of lines }
|
||||||
AsmWrite(#9#9'DB'#9);
|
AsmWrite(#9#9'DB'#9);
|
||||||
@ -473,17 +500,26 @@ unit ag386nsm;
|
|||||||
end;
|
end;
|
||||||
AsmLn;
|
AsmLn;
|
||||||
end;
|
end;
|
||||||
ait_label : begin
|
|
||||||
|
ait_label :
|
||||||
|
begin
|
||||||
if pai_label(hp)^.l^.is_used then
|
if pai_label(hp)^.l^.is_used then
|
||||||
AsmWriteLn(pai_label(hp)^.l^.name+':');
|
AsmWriteLn(pai_label(hp)^.l^.name+':');
|
||||||
end;
|
end;
|
||||||
ait_direct : begin
|
|
||||||
|
ait_direct :
|
||||||
|
begin
|
||||||
AsmWritePChar(pai_direct(hp)^.str);
|
AsmWritePChar(pai_direct(hp)^.str);
|
||||||
AsmLn;
|
AsmLn;
|
||||||
end;
|
end;
|
||||||
ait_symbol : begin
|
|
||||||
|
ait_symbol :
|
||||||
|
begin
|
||||||
if pai_symbol(hp)^.is_global then
|
if pai_symbol(hp)^.is_global then
|
||||||
AsmWriteLn(#9'GLOBAL '+pai_symbol(hp)^.sym^.name);
|
begin
|
||||||
|
AsmWrite(#9'GLOBAL ');
|
||||||
|
AsmWriteLn(pai_symbol(hp)^.sym^.name);
|
||||||
|
end;
|
||||||
AsmWrite(pai_symbol(hp)^.sym^.name);
|
AsmWrite(pai_symbol(hp)^.sym^.name);
|
||||||
if assigned(hp^.next) and not(pai(hp^.next)^.typ in
|
if assigned(hp^.next) and not(pai(hp^.next)^.typ in
|
||||||
[ait_const_32bit,ait_const_16bit,ait_const_8bit,
|
[ait_const_32bit,ait_const_16bit,ait_const_8bit,
|
||||||
@ -491,10 +527,13 @@ unit ag386nsm;
|
|||||||
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_string]) then
|
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_string]) then
|
||||||
AsmWriteLn(':')
|
AsmWriteLn(':')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_symbol_end :
|
ait_symbol_end :
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
ait_instruction : begin
|
|
||||||
|
ait_instruction :
|
||||||
|
begin
|
||||||
{ We need intel order, no At&t }
|
{ We need intel order, no At&t }
|
||||||
paicpu(hp)^.SwapOperands;
|
paicpu(hp)^.SwapOperands;
|
||||||
{ Reset }
|
{ Reset }
|
||||||
@ -530,7 +569,9 @@ unit ag386nsm;
|
|||||||
ait_force_line,
|
ait_force_line,
|
||||||
ait_stab_function_name : ;
|
ait_stab_function_name : ;
|
||||||
{$endif GDB}
|
{$endif GDB}
|
||||||
ait_cut : begin
|
|
||||||
|
ait_cut :
|
||||||
|
begin
|
||||||
{ only reset buffer if nothing has changed }
|
{ only reset buffer if nothing has changed }
|
||||||
if AsmSize=AsmStartSize then
|
if AsmSize=AsmStartSize then
|
||||||
AsmClear
|
AsmClear
|
||||||
@ -553,7 +594,9 @@ ait_stab_function_name : ;
|
|||||||
AsmWriteLn('SECTION '+target_asm.secnames[lastsec]);
|
AsmWriteLn('SECTION '+target_asm.secnames[lastsec]);
|
||||||
AsmStartSize:=AsmSize;
|
AsmStartSize:=AsmSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_marker : ;
|
ait_marker : ;
|
||||||
|
|
||||||
else
|
else
|
||||||
internalerror(10000);
|
internalerror(10000);
|
||||||
end;
|
end;
|
||||||
@ -574,11 +617,7 @@ ait_stab_function_name : ;
|
|||||||
procedure ti386nasmasmlist.WriteExternals;
|
procedure ti386nasmasmlist.WriteExternals;
|
||||||
begin
|
begin
|
||||||
currentasmlist:=@self;
|
currentasmlist:=@self;
|
||||||
{$ifdef Delphi}
|
|
||||||
AsmSymbolList^.foreach(@writeexternal);
|
|
||||||
{$else}
|
|
||||||
AsmSymbolList^.foreach({$ifndef TP}@{$endif}writeexternal);
|
AsmSymbolList^.foreach({$ifndef TP}@{$endif}writeexternal);
|
||||||
{$endif Delphi}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -617,7 +656,11 @@ ait_stab_function_name : ;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.51 1999-09-10 15:41:18 peter
|
Revision 1.52 1999-09-13 16:27:24 peter
|
||||||
|
* fix for jmps to be always near
|
||||||
|
* string writing fixed
|
||||||
|
|
||||||
|
Revision 1.51 1999/09/10 15:41:18 peter
|
||||||
* added symbol_end
|
* added symbol_end
|
||||||
|
|
||||||
Revision 1.50 1999/09/02 18:47:43 daniel
|
Revision 1.50 1999/09/02 18:47:43 daniel
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user