mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 09:10:53 +02:00
* Adapt to TExternCain move to aasmcpu unit
+ Make sure that a lone reference to DGROUP also generates a 'GROUP DGROUP' statement + Add %LINE support + Add $DEBUG for i8086 nasm git-svn-id: trunk@34080 -
This commit is contained in:
parent
38f751573a
commit
40ff777693
@ -255,54 +255,6 @@ interface
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PExternChain = ^TExternChain;
|
|
||||||
|
|
||||||
TExternChain = Record
|
|
||||||
psym : pshortstring;
|
|
||||||
is_defined : boolean;
|
|
||||||
next : PExternChain;
|
|
||||||
end;
|
|
||||||
|
|
||||||
const
|
|
||||||
FEC : PExternChain = nil;
|
|
||||||
|
|
||||||
procedure AddSymbol(symname : string; defined : boolean);
|
|
||||||
var
|
|
||||||
EC : PExternChain;
|
|
||||||
begin
|
|
||||||
EC:=FEC;
|
|
||||||
while assigned(EC) do
|
|
||||||
begin
|
|
||||||
if EC^.psym^=symname then
|
|
||||||
begin
|
|
||||||
if defined then
|
|
||||||
EC^.is_defined:=true;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
EC:=EC^.next;
|
|
||||||
end;
|
|
||||||
New(EC);
|
|
||||||
EC^.next:=FEC;
|
|
||||||
FEC:=EC;
|
|
||||||
FEC^.psym:=stringdup(symname);
|
|
||||||
FEC^.is_defined := defined;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure FreeExternChainList;
|
|
||||||
var
|
|
||||||
EC : PExternChain;
|
|
||||||
begin
|
|
||||||
EC:=FEC;
|
|
||||||
while assigned(EC) do
|
|
||||||
begin
|
|
||||||
FEC:=EC^.next;
|
|
||||||
stringdispose(EC^.psym);
|
|
||||||
Dispose(EC);
|
|
||||||
EC:=FEC;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TX86NasmAssembler
|
TX86NasmAssembler
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -419,6 +371,8 @@ interface
|
|||||||
else if o.ref^.refaddr=addr_dgroup then
|
else if o.ref^.refaddr=addr_dgroup then
|
||||||
begin
|
begin
|
||||||
writer.AsmWrite('DGROUP');
|
writer.AsmWrite('DGROUP');
|
||||||
|
{ Make sure GROUP DGROUP is generated }
|
||||||
|
FSectionsInDGROUP.Add('',Pointer(self));
|
||||||
end
|
end
|
||||||
else if o.ref^.refaddr=addr_fardataseg then
|
else if o.ref^.refaddr=addr_fardataseg then
|
||||||
begin
|
begin
|
||||||
@ -648,11 +602,14 @@ interface
|
|||||||
if current_settings.x86memorymodel=mm_huge then
|
if current_settings.x86memorymodel=mm_huge then
|
||||||
WriteSection(sec_data,'',2);
|
WriteSection(sec_data,'',2);
|
||||||
writer.AsmLn;
|
writer.AsmLn;
|
||||||
|
if FSectionsInDGROUP.Count>0 then
|
||||||
|
begin
|
||||||
writer.AsmWrite('GROUP DGROUP');
|
writer.AsmWrite('GROUP DGROUP');
|
||||||
for i:=0 to FSectionsInDGROUP.Count-1 do
|
for i:=0 to FSectionsInDGROUP.Count-1 do
|
||||||
writer.AsmWrite(' '+FSectionsInDGROUP.NameOfIndex(i));
|
writer.AsmWrite(' '+FSectionsInDGROUP.NameOfIndex(i));
|
||||||
writer.AsmLn;
|
writer.AsmLn;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
{$endif i8086}
|
{$endif i8086}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -675,10 +632,15 @@ interface
|
|||||||
prefix, LastSecName : string;
|
prefix, LastSecName : string;
|
||||||
LastAlign : Byte;
|
LastAlign : Byte;
|
||||||
cpu: tcputype;
|
cpu: tcputype;
|
||||||
|
prevfileinfo : tfileposinfo;
|
||||||
|
previnfile : tinputfile;
|
||||||
|
NewObject : boolean;
|
||||||
begin
|
begin
|
||||||
if not assigned(p) then
|
if not assigned(p) then
|
||||||
exit;
|
exit;
|
||||||
InlineLevel:=0;
|
InlineLevel:=0;
|
||||||
|
NewObject:=true;
|
||||||
|
|
||||||
{ lineinfo is only needed for al_procedures (PFV) }
|
{ lineinfo is only needed for al_procedures (PFV) }
|
||||||
do_line:=(cs_asm_source in current_settings.globalswitches) or
|
do_line:=(cs_asm_source in current_settings.globalswitches) or
|
||||||
((cs_lineinfo in current_settings.moduleswitches)
|
((cs_lineinfo in current_settings.moduleswitches)
|
||||||
@ -689,10 +651,25 @@ interface
|
|||||||
prefetch(pointer(hp.next)^);
|
prefetch(pointer(hp.next)^);
|
||||||
if not(hp.typ in SkipLineInfo) then
|
if not(hp.typ in SkipLineInfo) then
|
||||||
begin
|
begin
|
||||||
|
previnfile:=lastinfile;
|
||||||
|
prevfileinfo:=lastfileinfo;
|
||||||
current_filepos:=tailineinfo(hp).fileinfo;
|
current_filepos:=tailineinfo(hp).fileinfo;
|
||||||
|
|
||||||
{ no line info for inlined code }
|
{ no line info for inlined code }
|
||||||
if do_line and (inlinelevel=0) then
|
if do_line and (inlinelevel=0) then
|
||||||
WriteSourceLine(hp as tailineinfo);
|
WriteSourceLine(hp as tailineinfo);
|
||||||
|
if (lastfileinfo.line<>prevfileinfo.line) or
|
||||||
|
(previnfile<>lastinfile) then
|
||||||
|
begin
|
||||||
|
{ +0 postfix means no line increment per assembler instruction }
|
||||||
|
writer.AsmWrite('%LINE '+tostr(current_filepos.line)+'+0');
|
||||||
|
if assigned(lastinfile) and ((previnfile<>lastinfile) or NewObject) then
|
||||||
|
writer.AsmWriteLn(' '+lastinfile.name)
|
||||||
|
else
|
||||||
|
writer.AsmLn;
|
||||||
|
NewObject:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case hp.typ of
|
case hp.typ of
|
||||||
@ -970,8 +947,8 @@ interface
|
|||||||
writer.AsmWrite(tai_symbol(hp).sym.name);
|
writer.AsmWrite(tai_symbol(hp).sym.name);
|
||||||
if SmartAsm then
|
if SmartAsm then
|
||||||
AddSymbol(tai_symbol(hp).sym.name,true);
|
AddSymbol(tai_symbol(hp).sym.name,true);
|
||||||
if assigned(hp.next) and not(tai(hp.next).typ in
|
if (not assigned(hp.next)) or (assigned(hp.next) and not(tai(hp.next).typ in
|
||||||
[ait_const,ait_realconst,ait_string]) then
|
[ait_const,ait_realconst,ait_string])) then
|
||||||
writer.AsmWriteLn(':')
|
writer.AsmWriteLn(':')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1096,6 +1073,7 @@ interface
|
|||||||
if LastSecType<>sec_none then
|
if LastSecType<>sec_none then
|
||||||
WriteSection(LastSecType,LastSecName,LastAlign);
|
WriteSection(LastSecType,LastSecName,LastAlign);
|
||||||
writer.MarkEmpty;
|
writer.MarkEmpty;
|
||||||
|
NewObject:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1253,7 +1231,14 @@ interface
|
|||||||
system_i8086_msdos,
|
system_i8086_msdos,
|
||||||
system_i8086_win16,
|
system_i8086_win16,
|
||||||
system_i8086_embedded:
|
system_i8086_embedded:
|
||||||
|
begin
|
||||||
FormatName:='obj';
|
FormatName:='obj';
|
||||||
|
if (cs_debuginfo in current_settings.moduleswitches) or
|
||||||
|
(cs_asm_source in current_settings.globalswitches) then
|
||||||
|
Replace(result,'$DEBUG','-g')
|
||||||
|
else
|
||||||
|
Replace(result,'$DEBUG','');
|
||||||
|
end
|
||||||
else
|
else
|
||||||
internalerror(2014082060);
|
internalerror(2014082060);
|
||||||
end;
|
end;
|
||||||
@ -1304,7 +1289,7 @@ interface
|
|||||||
id : as_i8086_nasm;
|
id : as_i8086_nasm;
|
||||||
idtxt : 'NASM';
|
idtxt : 'NASM';
|
||||||
asmbin : 'nasm';
|
asmbin : 'nasm';
|
||||||
asmcmd : '-f $FORMAT -o $OBJ -w-orphan-labels $EXTRAOPT $ASM';
|
asmcmd : '-f $FORMAT $DEBUG -o $OBJ -w-orphan-labels $EXTRAOPT $ASM';
|
||||||
supported_targets : [system_i8086_msdos,system_i8086_win16,system_i8086_embedded];
|
supported_targets : [system_i8086_msdos,system_i8086_win16,system_i8086_embedded];
|
||||||
flags : [af_needar,af_no_debug];
|
flags : [af_needar,af_no_debug];
|
||||||
labelprefix : '..@';
|
labelprefix : '..@';
|
||||||
|
Loading…
Reference in New Issue
Block a user