* better smartlinking support

This commit is contained in:
peter 1999-07-03 00:27:02 +00:00
parent 176f1d4cd8
commit 1e75d2d672
4 changed files with 81 additions and 64 deletions

View File

@ -701,34 +701,37 @@ unit ag386att;
ait_cut :
begin
{ only reset buffer if nothing has changed }
if AsmSize=AsmStartSize then
AsmClear
else
if SmartAsm then
begin
AsmClose;
DoAssemble;
if pai_cut(hp)^.EndName then
IsEndFile:=true;
AsmCreate;
end;
{ avoid empty files }
while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
begin
if pai(hp^.next)^.typ=ait_section then
lastsec:=pai_section(hp^.next)^.sec;
hp:=pai(hp^.next);
end;
{ only reset buffer if nothing has changed }
if AsmSize=AsmStartSize then
AsmClear
else
begin
AsmClose;
DoAssemble;
if pai_cut(hp)^.EndName then
IsEndFile:=true;
AsmCreate;
end;
{ avoid empty files }
while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
begin
if pai(hp^.next)^.typ=ait_section then
lastsec:=pai_section(hp^.next)^.sec;
hp:=pai(hp^.next);
end;
{$ifdef GDB}
{ force write of filename }
FillChar(stabslastfileinfo,sizeof(stabslastfileinfo),0);
includecount:=0;
funcname:=nil;
WriteFileLineInfo(hp^.fileinfo);
{ force write of filename }
FillChar(stabslastfileinfo,sizeof(stabslastfileinfo),0);
includecount:=0;
funcname:=nil;
WriteFileLineInfo(hp^.fileinfo);
{$endif GDB}
if lastsec<>sec_none then
AsmWriteLn(ait_section2str(lastsec));
AsmStartSize:=AsmSize;
if lastsec<>sec_none then
AsmWriteLn(ait_section2str(lastsec));
AsmStartSize:=AsmSize;
end;
end;
ait_marker :
@ -811,7 +814,10 @@ unit ag386att;
end.
{
$Log$
Revision 1.2 1999-06-22 15:25:14 peter
Revision 1.3 1999-07-03 00:27:04 peter
* better smartlinking support
Revision 1.2 1999/06/22 15:25:14 peter
* merged
Revision 1.1.2.1 1999/06/22 15:23:08 peter

View File

@ -46,6 +46,7 @@ type
asmfile, { current .s and .o file }
objfile,
as_bin : string;
SmartAsm : boolean;
IsEndFile : boolean; { special 'end' file for import dir ? }
{outfile}
AsmSize,
@ -53,7 +54,7 @@ type
outcnt : longint;
outbuf : array[0..AsmOutSize-1] of char;
outfile : file;
Constructor Init;
Constructor Init(smart:boolean);
Destructor Done;
Function FindAssembler:string;
Function CallAssembler(const command,para:string):Boolean;
@ -73,7 +74,7 @@ type
procedure WriteAsmList;virtual;
end;
Procedure GenerateAsm;
Procedure GenerateAsm(smart:boolean);
Procedure OnlyAsm;
var
@ -329,7 +330,7 @@ end;
procedure TAsmList.AsmCreate;
begin
if (cs_smartlink in aktmoduleswitches) then
if SmartAsm then
NextSmartName;
{$ifdef linux}
if DoPipe then
@ -408,7 +409,7 @@ begin
end;
Constructor TAsmList.Init;
Constructor TAsmList.Init(smart:boolean);
var
i : word;
begin
@ -419,8 +420,9 @@ begin
OutCnt:=0;
SmartLinkFilesCnt:=0;
IsEndFile:=false;
SmartAsm:=smart;
{ Which path will be used ? }
if (cs_smartlink in aktmoduleswitches) then
if SmartAsm then
begin
path:=current_module^.path^+FixFileName(current_module^.modulename^)+target_info.smartext;
{$I-}
@ -443,7 +445,7 @@ end;
Generate Assembler Files Main Procedure
*****************************************************************************}
Procedure GenerateAsm;
Procedure GenerateAsm(smart:boolean);
var
a : PAsmList;
{$ifdef i386}
@ -462,23 +464,21 @@ begin
begin
case aktoutputformat of
as_i386_dbg :
b:=new(pi386binasmlist,Init(og_dbg));
b:=new(pi386binasmlist,Init(og_dbg,smart));
as_i386_coff :
b:=new(pi386binasmlist,Init(og_coff));
b:=new(pi386binasmlist,Init(og_coff,smart));
as_i386_pecoff :
b:=new(pi386binasmlist,Init(og_pecoff));
b:=new(pi386binasmlist,Init(og_pecoff,smart));
end;
b^.WriteBin;
dispose(b,done);
if assigned(current_module^.ppufilename) then
begin
if (cs_smartlink in aktmoduleswitches) then
if smart then
SynchronizeFileTime(current_module^.ppufilename^,current_module^.staticlibfilename^)
else
SynchronizeFileTime(current_module^.ppufilename^,current_module^.objfilename^);
end;
if assigned(current_module^.ppufilename) then
SynchronizeFileTime(current_module^.ppufilename^,current_module^.objfilename^);
exit;
end;
{$endif NoAg386Bin}
@ -486,36 +486,36 @@ begin
as_i386_as,
as_i386_as_aout,
as_i386_asw :
a:=new(pi386attasmlist,Init);
a:=new(pi386attasmlist,Init(smart));
{$endif NoAg386Att}
{$ifndef NoAg386Nsm}
as_i386_nasmcoff,
as_i386_nasmelf,
as_i386_nasmobj :
a:=new(pi386nasmasmlist,Init);
a:=new(pi386nasmasmlist,Init(smart));
{$endif NoAg386Nsm}
{$ifndef NoAg386Int}
as_i386_tasm :
a:=new(pi386intasmlist,Init);
a:=new(pi386intasmlist,Init(smart));
{$endif NoAg386Int}
{$endif}
{$ifdef m68k}
{$ifndef NoAg68kGas}
as_m68k_as,
as_m68k_gas :
a:=new(pm68kgasasmlist,Init);
a:=new(pm68kgasasmlist,Init(smart));
{$endif NoAg86KGas}
{$ifndef NoAg68kMot}
as_m68k_mot :
a:=new(pm68kmotasmlist,Init);
a:=new(pm68kmotasmlist,Init(smart));
{$endif NoAg86kMot}
{$ifndef NoAg68kMit}
as_m68k_mit :
a:=new(pm68kmitasmlist,Init);
a:=new(pm68kmitasmlist,Init(smart));
{$endif NoAg86KMot}
{$ifndef NoAg68kMpw}
as_m68k_mpw :
a:=new(pm68kmpwasmlist,Init);
a:=new(pm68kmpwasmlist,Init(smart));
{$endif NoAg68kMpw}
{$endif}
else
@ -538,7 +538,7 @@ Procedure OnlyAsm;
var
a : PAsmList;
begin
a:=new(pasmlist,Init);
a:=new(pasmlist,Init(false));
a^.DoAssemble;
dispose(a,Done);
end;
@ -547,7 +547,10 @@ end;
end.
{
$Log$
Revision 1.49 1999-06-28 16:02:29 peter
Revision 1.50 1999-07-03 00:27:05 peter
* better smartlinking support
Revision 1.49 1999/06/28 16:02:29 peter
* merged
Revision 1.48.2.1 1999/06/28 15:55:39 peter

View File

@ -56,12 +56,13 @@ unit og386;
pobjectoutput = ^tobjectoutput;
tobjectoutput = object
objsmart : boolean;
writer : pobjectwriter;
path : pathstr;
ObjFile : string;
IsEndFile : boolean; { special 'end' file for import dir ? }
currsec : tsection;
constructor init;
constructor init(smart:boolean);
destructor done;virtual;
{ Writing }
procedure NextSmartName;
@ -149,13 +150,14 @@ unit og386;
tobjectoutput
****************************************************************************}
constructor tobjectoutput.init;
constructor tobjectoutput.init(smart:boolean);
var
i : longint;
begin
objsmart:=smart;
objfile:=current_module^.objfilename^;
{ Which path will be used ? }
if (cs_smartlink in aktmoduleswitches) and
if objsmart and
(cs_asm_leave in aktglobalswitches) then
begin
path:=current_module^.path^+FixFileName(current_module^.modulename^)+target_info.smartext;
@ -168,7 +170,7 @@ unit og386;
else
path:=current_module^.path^;
{ init writer }
if (cs_smartlink in aktmoduleswitches) and
if objsmart and
not(cs_asm_leave in aktglobalswitches) then
writer:=New(parobjectwriter,Init(current_module^.staticlibfilename^))
else
@ -216,7 +218,7 @@ unit og386;
procedure tobjectoutput.initwriting;
begin
if (cs_smartlink in aktmoduleswitches) then
if objsmart then
NextSmartName;
writer^.create(objfile);
end;
@ -275,7 +277,10 @@ unit og386;
end.
{
$Log$
Revision 1.8 1999-05-19 12:41:48 florian
Revision 1.9 1999-07-03 00:27:03 peter
* better smartlinking support
Revision 1.8 1999/05/19 12:41:48 florian
* made source compilable with TP (too long line)
* default values for set properties fixed

View File

@ -121,7 +121,7 @@ unit og386cff;
strs,
syms : Pdynamicarray;
initsym : longint;
constructor init;
constructor init(smart:boolean);
destructor done;virtual;
procedure initwriting;virtual;
procedure donewriting;virtual;
@ -133,7 +133,7 @@ unit og386cff;
procedure writesymbol(p:pasmsymbol);virtual;
procedure writestabs(section:tsection;offset:longint;p:pchar;nidx,nother,line:longint;reloc:boolean);virtual;
procedure writesymstabs(section:tsection;offset:longint;p:pchar;ps:pasmsymbol;
nidx,nother,line:longint;reloc:boolean);virtual;
nidx,nother,line:longint;reloc:boolean);virtual;
function text_flags : longint;virtual;
function data_flags : longint;virtual;
function bss_flags : longint;virtual;
@ -148,7 +148,7 @@ unit og386cff;
pdjgppcoffoutput = ^tdjgppcoffoutput;
tdjgppcoffoutput = object(tgenericcoffoutput)
constructor init;
constructor init(smart:boolean);
function text_flags : longint;virtual;
function data_flags : longint;virtual;
function bss_flags : longint;virtual;
@ -157,7 +157,7 @@ unit og386cff;
pwin32coffoutput = ^twin32coffoutput;
twin32coffoutput = object(tgenericcoffoutput)
constructor init;
constructor init(smart:boolean);
function text_flags : longint;virtual;
function data_flags : longint;virtual;
function bss_flags : longint;virtual;
@ -316,9 +316,9 @@ unit og386cff;
strsresize = 8192;
{$endif}
constructor tgenericcoffoutput.init;
constructor tgenericcoffoutput.init(smart:boolean);
begin
inherited init;
inherited init(smart);
end;
@ -884,9 +884,9 @@ unit og386cff;
DJGppcoffoutput
****************************************************************************}
constructor tdjgppcoffoutput.init;
constructor tdjgppcoffoutput.init(smart:boolean);
begin
inherited init;
inherited init(smart);
win32:=false;
end;
@ -916,9 +916,9 @@ unit og386cff;
Win32coffoutput
****************************************************************************}
constructor twin32coffoutput.init;
constructor twin32coffoutput.init(smart:boolean);
begin
inherited init;
inherited init(smart);
win32:=true;
end;
@ -946,7 +946,10 @@ unit og386cff;
end.
{
$Log$
Revision 1.8 1999-06-03 16:39:09 pierre
Revision 1.9 1999-07-03 00:27:02 peter
* better smartlinking support
Revision 1.8 1999/06/03 16:39:09 pierre
* EXTERNALBSS fixed for stabs and default again
Revision 1.7 1999/05/21 13:55:03 peter