mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 02:30:41 +01:00
* refactored "ar" object writer creation in the internal assembler to allow
having different implementations of an internal "ar" writer git-svn-id: trunk@30667 -
This commit is contained in:
parent
3684e7665d
commit
d204aaab72
@ -33,7 +33,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
systems,globtype,globals,aasmbase,aasmtai,aasmdata,ogbase,finput;
|
||||
systems,globtype,globals,aasmbase,aasmtai,aasmdata,ogbase,owbase,finput;
|
||||
|
||||
const
|
||||
{ maximum of aasmoutput lists there will be }
|
||||
@ -147,6 +147,7 @@ interface
|
||||
TInternalAssembler=class(TAssembler)
|
||||
private
|
||||
FCObjOutput : TObjOutputclass;
|
||||
FCInternalAr : TObjectWriterClass;
|
||||
{ the aasmoutput lists that need to be processed }
|
||||
lists : byte;
|
||||
list : array[1..maxoutputlists] of TAsmList;
|
||||
@ -165,6 +166,7 @@ interface
|
||||
ObjData : TObjData;
|
||||
ObjOutput : tObjOutput;
|
||||
property CObjOutput:TObjOutputclass read FCObjOutput write FCObjOutput;
|
||||
property CInternalAr : TObjectWriterClass read FCInternalAr write FCInternalAr;
|
||||
public
|
||||
constructor create(smart:boolean);override;
|
||||
destructor destroy;override;
|
||||
@ -194,7 +196,7 @@ Implementation
|
||||
cpuinfo,
|
||||
{$endif m68k or arm}
|
||||
aasmcpu,
|
||||
owbase,owar,owomflib
|
||||
owar,owomflib
|
||||
;
|
||||
|
||||
var
|
||||
@ -1824,7 +1826,7 @@ Implementation
|
||||
begin
|
||||
if not(cs_asm_leave in current_settings.globalswitches) and
|
||||
not(af_needar in target_asm.flags) then
|
||||
ObjWriter:=TARObjectWriter.create(current_module.staticlibfilename)
|
||||
ObjWriter:=CInternalAr.CreateAr(current_module.staticlibfilename)
|
||||
else
|
||||
ObjWriter:=TObjectwriter.create;
|
||||
|
||||
|
||||
@ -282,6 +282,7 @@ implementation
|
||||
cutils,verbose,globals,
|
||||
fmodule,aasmtai,aasmdata,
|
||||
ogmap,
|
||||
owar,
|
||||
version
|
||||
;
|
||||
|
||||
@ -2846,6 +2847,7 @@ const pemagic : array[0..3] of byte = (
|
||||
begin
|
||||
inherited Create(smart);
|
||||
CObjOutput:=TDJCoffObjOutput;
|
||||
CInternalAr:=tarobjectwriter;
|
||||
end;
|
||||
|
||||
|
||||
@ -2857,6 +2859,7 @@ const pemagic : array[0..3] of byte = (
|
||||
begin
|
||||
inherited Create(smart);
|
||||
CObjOutput:=TPECoffObjOutput;
|
||||
CInternalAr:=tarobjectwriter;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -344,7 +344,7 @@ implementation
|
||||
SysUtils,
|
||||
verbose,
|
||||
export,expunix,
|
||||
cutils,globals,fmodule;
|
||||
cutils,globals,fmodule,owar;
|
||||
|
||||
const
|
||||
symbolresize = 200*18;
|
||||
@ -1305,6 +1305,7 @@ implementation
|
||||
begin
|
||||
inherited Create(smart);
|
||||
CObjOutput:=TElfObjectOutput;
|
||||
CInternalAr:=tarobjectwriter;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -152,6 +152,9 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
owar;
|
||||
|
||||
{ TmachoObjData }
|
||||
|
||||
constructor TmachoObjData.create(const n: string);
|
||||
@ -355,6 +358,7 @@ implementation
|
||||
begin
|
||||
inherited create(smart);
|
||||
CObjOutput:=TMachoObjectOutput;
|
||||
CInternalAr:=tarobjectwriter;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -326,7 +326,7 @@ implementation
|
||||
SysUtils,
|
||||
cutils,verbose,globals,
|
||||
fmodule,aasmdata,
|
||||
ogmap,export
|
||||
ogmap,export,owar
|
||||
;
|
||||
|
||||
|
||||
@ -1475,6 +1475,7 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
|
||||
begin
|
||||
inherited Create(smart);
|
||||
CObjOutput:=TNLMCoffObjOutput;
|
||||
CInternalAr:=tarobjectwriter;
|
||||
end;
|
||||
|
||||
constructor TNLMCoffObjInput.create;
|
||||
|
||||
@ -41,7 +41,7 @@ type
|
||||
end;
|
||||
|
||||
tarobjectwriter=class(tobjectwriter)
|
||||
constructor create(const Aarfn:string);
|
||||
constructor createAr(const Aarfn:string);override;
|
||||
destructor destroy;override;
|
||||
function createfile(const fn:string):boolean;override;
|
||||
procedure closefile;override;
|
||||
@ -159,7 +159,7 @@ implementation
|
||||
TArObjectWriter
|
||||
*****************************************************************************}
|
||||
|
||||
constructor tarobjectwriter.create(const Aarfn:string);
|
||||
constructor tarobjectwriter.createAr(const Aarfn:string);
|
||||
var
|
||||
time : TSystemTime;
|
||||
begin
|
||||
|
||||
@ -41,6 +41,7 @@ type
|
||||
fobjsize : longword;
|
||||
public
|
||||
constructor create;
|
||||
constructor createAr(const Aarfn:string);virtual;
|
||||
destructor destroy;override;
|
||||
function createfile(const fn:string):boolean;virtual;
|
||||
procedure closefile;virtual;
|
||||
@ -52,6 +53,8 @@ type
|
||||
property ObjSize:longword read FObjSize;
|
||||
end;
|
||||
|
||||
tobjectwriterclass = class of tobjectwriter;
|
||||
|
||||
tobjectreader=class
|
||||
private
|
||||
f : TCCustomFileStream;
|
||||
@ -105,6 +108,11 @@ begin
|
||||
freemem(buf,bufsize);
|
||||
end;
|
||||
|
||||
constructor tobjectwriter.createAr(const Aarfn:string);
|
||||
begin
|
||||
InternalError(2015041901);
|
||||
end;
|
||||
|
||||
|
||||
function tobjectwriter.createfile(const fn:string):boolean;
|
||||
begin
|
||||
|
||||
@ -389,7 +389,7 @@ implementation
|
||||
SmartFilesCount:=0;
|
||||
SmartHeaderCount:=0;
|
||||
current_module.linkotherstaticlibs.add(current_module.importlibfilename,link_always);
|
||||
ObjWriter:=TARObjectWriter.create(current_module.importlibfilename);
|
||||
ObjWriter:=TARObjectWriter.CreateAr(current_module.importlibfilename);
|
||||
ObjOutput:=TPECoffObjOutput.Create(ObjWriter);
|
||||
for i:=0 to current_module.ImportLibraryList.Count-1 do
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user