mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-31 14:22:44 +02:00
Merged revision(s) 28689 from branches/svenbarth/packages:
Extract functionality that is shared between the metadata files for units (PPU) and for packages (PCP) into a parent class called tentryfile + add new unit entfile which contains the new tentryfile class and related types and constants * ppu.pas: - remove methods, fields, types and constants which were moved to entfile.pas * replace the parts of tppuheader shared with tentryheader by a field of type tentryheader fppu.pas, pmodules.pas, utils/ppumove.pp, utils/ppuutils/ppudump.pp: + add entfile to uses * adjust access to common header fields node.pas, symdef.pas, symsym.pas, symtable.pas, wpoinfo.pas, utils/ppufiles.pp: + add entfile to uses ........ git-svn-id: trunk@32976 -
This commit is contained in:
parent
7f0b676af1
commit
02e56f410d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -167,6 +167,7 @@ compiler/defcmp.pas svneol=native#text/plain
|
||||
compiler/defutil.pas svneol=native#text/plain
|
||||
compiler/dirparse.pas svneol=native#text/plain
|
||||
compiler/elfbase.pas svneol=native#text/plain
|
||||
compiler/entfile.pas svneol=native#text/plain
|
||||
compiler/export.pas svneol=native#text/plain
|
||||
compiler/expunix.pas svneol=native#text/plain
|
||||
compiler/finput.pas svneol=native#text/plain
|
||||
|
1150
compiler/entfile.pas
Normal file
1150
compiler/entfile.pas
Normal file
File diff suppressed because it is too large
Load Diff
@ -118,7 +118,8 @@ uses
|
||||
scanner,
|
||||
aasmbase,ogbase,
|
||||
parser,
|
||||
comphook;
|
||||
comphook,
|
||||
entfile;
|
||||
|
||||
|
||||
var
|
||||
@ -217,7 +218,7 @@ var
|
||||
exit;
|
||||
end;
|
||||
{ check the target processor }
|
||||
if tsystemcpu(ppufile.header.cpu)<>target_cpu then
|
||||
if tsystemcpu(ppufile.header.common.cpu)<>target_cpu then
|
||||
begin
|
||||
ppufile.free;
|
||||
ppufile:=nil;
|
||||
@ -225,7 +226,7 @@ var
|
||||
exit;
|
||||
end;
|
||||
{ check target }
|
||||
if tsystem(ppufile.header.target)<>target_info.system then
|
||||
if tsystem(ppufile.header.common.target)<>target_info.system then
|
||||
begin
|
||||
ppufile.free;
|
||||
ppufile:=nil;
|
||||
@ -234,7 +235,7 @@ var
|
||||
end;
|
||||
{$ifdef i8086}
|
||||
{ check i8086 memory model flags }
|
||||
if ((ppufile.header.flags and uf_i8086_far_code)<>0) xor
|
||||
if ((ppufile.header.common.flags and uf_i8086_far_code)<>0) xor
|
||||
(current_settings.x86memorymodel in [mm_medium,mm_large,mm_huge]) then
|
||||
begin
|
||||
ppufile.free;
|
||||
@ -242,7 +243,7 @@ var
|
||||
Message(unit_u_ppu_invalid_memory_model,@queuecomment);
|
||||
exit;
|
||||
end;
|
||||
if ((ppufile.header.flags and uf_i8086_far_data)<>0) xor
|
||||
if ((ppufile.header.common.flags and uf_i8086_far_data)<>0) xor
|
||||
(current_settings.x86memorymodel in [mm_compact,mm_large]) then
|
||||
begin
|
||||
ppufile.free;
|
||||
@ -250,7 +251,7 @@ var
|
||||
Message(unit_u_ppu_invalid_memory_model,@queuecomment);
|
||||
exit;
|
||||
end;
|
||||
if ((ppufile.header.flags and uf_i8086_huge_data)<>0) xor
|
||||
if ((ppufile.header.common.flags and uf_i8086_huge_data)<>0) xor
|
||||
(current_settings.x86memorymodel=mm_huge) then
|
||||
begin
|
||||
ppufile.free;
|
||||
@ -258,7 +259,7 @@ var
|
||||
Message(unit_u_ppu_invalid_memory_model,@queuecomment);
|
||||
exit;
|
||||
end;
|
||||
if ((ppufile.header.flags and uf_i8086_cs_equals_ds)<>0) xor
|
||||
if ((ppufile.header.common.flags and uf_i8086_cs_equals_ds)<>0) xor
|
||||
(current_settings.x86memorymodel=mm_tiny) then
|
||||
begin
|
||||
ppufile.free;
|
||||
@ -270,7 +271,7 @@ var
|
||||
{$ifdef cpufpemu}
|
||||
{ check if floating point emulation is on?
|
||||
fpu emulation isn't unit levelwise because it affects calling convention }
|
||||
if ((ppufile.header.flags and uf_fpu_emulation)<>0) xor
|
||||
if ((ppufile.header.common.flags and uf_fpu_emulation)<>0) xor
|
||||
(cs_fp_emulation in current_settings.moduleswitches) then
|
||||
begin
|
||||
ppufile.free;
|
||||
@ -281,7 +282,7 @@ var
|
||||
{$endif cpufpemu}
|
||||
|
||||
{ Load values to be access easier }
|
||||
flags:=ppufile.header.flags;
|
||||
flags:=ppufile.header.common.flags;
|
||||
crc:=ppufile.header.checksum;
|
||||
interface_crc:=ppufile.header.interface_checksum;
|
||||
indirect_crc:=ppufile.header.indirect_checksum;
|
||||
@ -1243,14 +1244,14 @@ var
|
||||
{ flush to be sure }
|
||||
ppufile.flush;
|
||||
{ create and write header }
|
||||
ppufile.header.size:=ppufile.size;
|
||||
ppufile.header.common.size:=ppufile.size;
|
||||
ppufile.header.checksum:=ppufile.crc;
|
||||
ppufile.header.interface_checksum:=ppufile.interface_crc;
|
||||
ppufile.header.indirect_checksum:=ppufile.indirect_crc;
|
||||
ppufile.header.compiler:=wordversion;
|
||||
ppufile.header.cpu:=word(target_cpu);
|
||||
ppufile.header.target:=word(target_info.system);
|
||||
ppufile.header.flags:=flags;
|
||||
ppufile.header.common.compiler:=wordversion;
|
||||
ppufile.header.common.cpu:=word(target_cpu);
|
||||
ppufile.header.common.target:=word(target_info.system);
|
||||
ppufile.header.common.flags:=flags;
|
||||
ppufile.header.deflistsize:=current_module.deflist.count;
|
||||
ppufile.header.symlistsize:=current_module.symlist.count;
|
||||
ppufile.writeheader;
|
||||
@ -1349,14 +1350,14 @@ var
|
||||
|
||||
{ create and write header, this will only be used
|
||||
for debugging purposes }
|
||||
ppufile.header.size:=ppufile.size;
|
||||
ppufile.header.common.size:=ppufile.size;
|
||||
ppufile.header.checksum:=ppufile.crc;
|
||||
ppufile.header.interface_checksum:=ppufile.interface_crc;
|
||||
ppufile.header.indirect_checksum:=ppufile.indirect_crc;
|
||||
ppufile.header.compiler:=wordversion;
|
||||
ppufile.header.cpu:=word(target_cpu);
|
||||
ppufile.header.target:=word(target_info.system);
|
||||
ppufile.header.flags:=flags;
|
||||
ppufile.header.common.compiler:=wordversion;
|
||||
ppufile.header.common.cpu:=word(target_cpu);
|
||||
ppufile.header.common.target:=word(target_info.system);
|
||||
ppufile.header.common.flags:=flags;
|
||||
ppufile.writeheader;
|
||||
|
||||
ppufile.closefile;
|
||||
@ -1391,7 +1392,7 @@ var
|
||||
if (pu.u.interface_crc<>pu.interface_checksum) or
|
||||
(pu.u.indirect_crc<>pu.indirect_checksum) or
|
||||
(
|
||||
((ppufile.header.flags and uf_release)=0) and
|
||||
((ppufile.header.common.flags and uf_release)=0) and
|
||||
(pu.u.crc<>pu.checksum)
|
||||
) then
|
||||
begin
|
||||
|
@ -497,7 +497,7 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
verbose,ppu,comphook,
|
||||
verbose,entfile,comphook,
|
||||
symconst,
|
||||
nutils,nflw,
|
||||
defutil;
|
||||
|
@ -41,7 +41,7 @@ implementation
|
||||
aasmtai,aasmdata,aasmcpu,aasmbase,
|
||||
cgbase,cgobj,ngenutil,
|
||||
nbas,nutils,ncgutil,
|
||||
link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
|
||||
link,assemble,import,export,gendef,entfile,ppu,comprsrc,dbgbase,
|
||||
cresstr,procinfo,
|
||||
pexports,
|
||||
objcgutl,
|
||||
@ -1475,28 +1475,28 @@ type
|
||||
Exit;
|
||||
end;
|
||||
{ No .o file generated for this ppu, just skip }
|
||||
if (inppu.header.flags and uf_no_link)<>0 then
|
||||
if (inppu.header.common.flags and uf_no_link)<>0 then
|
||||
begin
|
||||
inppu.free;
|
||||
Result:=true;
|
||||
Exit;
|
||||
end;
|
||||
{ Already a lib? }
|
||||
if (inppu.header.flags and uf_in_library)<>0 then
|
||||
if (inppu.header.common.flags and uf_in_library)<>0 then
|
||||
begin
|
||||
inppu.free;
|
||||
Comment(V_Error,'PPU is already in a library : '+PPUFn);
|
||||
Exit;
|
||||
end;
|
||||
{ We need a static linked unit }
|
||||
if (inppu.header.flags and uf_static_linked)=0 then
|
||||
if (inppu.header.common.flags and uf_static_linked)=0 then
|
||||
begin
|
||||
inppu.free;
|
||||
Comment(V_Error,'PPU is not static linked : '+PPUFn);
|
||||
Exit;
|
||||
end;
|
||||
{ Check if shared is allowed }
|
||||
if tsystem(inppu.header.target) in [system_i386_go32v2] then
|
||||
if tsystem(inppu.header.common.target) in [system_i386_go32v2] then
|
||||
begin
|
||||
Comment(V_Error,'Shared library not supported for ppu target, switching to static library');
|
||||
MakeStatic:=true;
|
||||
@ -1509,11 +1509,11 @@ type
|
||||
outppu.createfile;
|
||||
{ Create new header, with the new flags }
|
||||
outppu.header:=inppu.header;
|
||||
outppu.header.flags:=outppu.header.flags or uf_in_library;
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_in_library;
|
||||
if MakeStatic then
|
||||
outppu.header.flags:=outppu.header.flags or uf_static_linked
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_static_linked
|
||||
else
|
||||
outppu.header.flags:=outppu.header.flags or uf_shared_linked;
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_shared_linked;
|
||||
{ read until the object files are found }
|
||||
untilb:=iblinkunitofiles;
|
||||
repeat
|
||||
|
1097
compiler/ppu.pas
1097
compiler/ppu.pas
File diff suppressed because it is too large
Load Diff
@ -1194,7 +1194,8 @@ implementation
|
||||
fmodule,
|
||||
{ other }
|
||||
gendef,
|
||||
fpccrc
|
||||
fpccrc,
|
||||
entfile
|
||||
;
|
||||
|
||||
{****************************************************************************
|
||||
|
@ -497,7 +497,9 @@ implementation
|
||||
aasmtai,aasmdata,
|
||||
{ codegen }
|
||||
paramgr,
|
||||
procinfo
|
||||
procinfo,
|
||||
{ ppu }
|
||||
entfile
|
||||
;
|
||||
|
||||
{****************************************************************************
|
||||
|
@ -28,9 +28,7 @@ interface
|
||||
{ common }
|
||||
cutils,cclasses,globtype,tokens,
|
||||
{ symtable }
|
||||
symconst,symbase,symtype,symdef,symsym,
|
||||
{ ppu }
|
||||
ppu;
|
||||
symconst,symbase,symtype,symdef,symsym;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
@ -438,7 +436,9 @@ implementation
|
||||
{ module }
|
||||
fmodule,
|
||||
{ codegen }
|
||||
procinfo
|
||||
procinfo,
|
||||
{ ppu }
|
||||
entfile
|
||||
;
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ Program ppufiles;
|
||||
|
||||
uses
|
||||
dos,
|
||||
ppu;
|
||||
ppu,entfile;
|
||||
|
||||
const
|
||||
Version = 'Version 1.00';
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
{$else unix}
|
||||
dos,
|
||||
{$endif unix}
|
||||
cutils,ppu,systems,
|
||||
cutils,ppu,entfile,systems,
|
||||
getopts;
|
||||
|
||||
const
|
||||
@ -274,7 +274,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
{ No .o file generated for this ppu, just skip }
|
||||
if (inppu.header.flags and uf_no_link)<>0 then
|
||||
if (inppu.header.common.flags and uf_no_link)<>0 then
|
||||
begin
|
||||
inppu.free;
|
||||
If Not Quiet then
|
||||
@ -283,21 +283,21 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
{ Already a lib? }
|
||||
if (inppu.header.flags and uf_in_library)<>0 then
|
||||
if (inppu.header.common.flags and uf_in_library)<>0 then
|
||||
begin
|
||||
inppu.free;
|
||||
Error('Error: PPU is already in a library : '+PPUFn,false);
|
||||
Exit;
|
||||
end;
|
||||
{ We need a static linked unit }
|
||||
if (inppu.header.flags and uf_static_linked)=0 then
|
||||
if (inppu.header.common.flags and uf_static_linked)=0 then
|
||||
begin
|
||||
inppu.free;
|
||||
Error('Error: PPU is not static linked : '+PPUFn,false);
|
||||
Exit;
|
||||
end;
|
||||
{ Check if shared is allowed }
|
||||
if tsystem(inppu.header.target) in [system_i386_go32v2] then
|
||||
if tsystem(inppu.header.common.target) in [system_i386_go32v2] then
|
||||
begin
|
||||
Writeln('Warning: shared library not supported for ppu target, switching to static library');
|
||||
MakeStatic:=true;
|
||||
@ -310,11 +310,11 @@ begin
|
||||
outppu.createfile;
|
||||
{ Create new header, with the new flags }
|
||||
outppu.header:=inppu.header;
|
||||
outppu.header.flags:=outppu.header.flags or uf_in_library;
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_in_library;
|
||||
if MakeStatic then
|
||||
outppu.header.flags:=outppu.header.flags or uf_static_linked
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_static_linked
|
||||
else
|
||||
outppu.header.flags:=outppu.header.flags or uf_shared_linked;
|
||||
outppu.header.common.flags:=outppu.header.common.flags or uf_shared_linked;
|
||||
{ read until the object files are found }
|
||||
untilb:=iblinkunitofiles;
|
||||
repeat
|
||||
|
@ -31,6 +31,7 @@ uses
|
||||
constexp,
|
||||
symconst,
|
||||
ppu,
|
||||
entfile,
|
||||
systems,
|
||||
globals,
|
||||
globtype,
|
||||
@ -2555,9 +2556,9 @@ begin
|
||||
toaddr :
|
||||
begin
|
||||
Write(['Address : ',getaword]);
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_i386 then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_i386 then
|
||||
Write([' (Far: ',getbyte<>0,')']);
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_i8086 then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_i8086 then
|
||||
if getbyte<>0 then
|
||||
Write([' (Far: TRUE, Segment=',getaword,')'])
|
||||
else
|
||||
@ -2585,7 +2586,7 @@ begin
|
||||
write ([space,' DefaultConst : ']);
|
||||
readderef('');
|
||||
if (vo_has_mangledname in varoptions) then
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_jvm then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
|
||||
writeln([space,'AMangledname : ',getansistring])
|
||||
else
|
||||
writeln([space,'SMangledname : ',getstring]);
|
||||
@ -2765,7 +2766,7 @@ begin
|
||||
write ([space,' Pointed Type : ']);
|
||||
readderef('',TPpuPointerDef(def).Ptr);
|
||||
writeln([space,' Has Pointer Math : ',(getbyte<>0)]);
|
||||
if tsystemcpu(ppufile.header.cpu) in [cpu_i8086,cpu_i386,cpu_x86_64] then
|
||||
if tsystemcpu(ppufile.header.common.cpu) in [cpu_i8086,cpu_i386,cpu_x86_64] then
|
||||
begin
|
||||
write([space,' X86 Pointer Type : ']);
|
||||
b:=getbyte;
|
||||
@ -2989,7 +2990,7 @@ begin
|
||||
writeln([space,' Range : ',arrdef.RangeLow,' to ',arrdef.RangeHigh]);
|
||||
write ([space,' Options : ']);
|
||||
readarraydefoptions(arrdef);
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_i8086 then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_i8086 then
|
||||
writeln([space,' Huge : ',(getbyte<>0)]);
|
||||
readsymtable('symbols', arrdef);
|
||||
end;
|
||||
@ -3000,7 +3001,7 @@ begin
|
||||
readcommondef('Procedure definition',defoptions,def);
|
||||
read_abstract_proc_def(calloption,procoptions,TPpuProcDef(def));
|
||||
if (po_has_mangledname in procoptions) then
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_jvm then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
|
||||
writeln([space,' Mangled name : ',getansistring])
|
||||
else
|
||||
writeln([space,' Mangled name : ',getstring]);
|
||||
@ -3017,7 +3018,7 @@ begin
|
||||
write ([space,' SymOptions : ']);
|
||||
readsymoptions(space+' ');
|
||||
writeln ([space,' Synthetic kind : ',Synthetic2Str(ppufile.getbyte)]);
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_powerpc then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_powerpc then
|
||||
begin
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
write ([space,' Library symbol : ']);
|
||||
@ -3086,7 +3087,7 @@ begin
|
||||
{ parast }
|
||||
readsymtable('parast',TPpuProcDef(def));
|
||||
delete(space,1,4);
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_jvm then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
|
||||
readderef('');
|
||||
end;
|
||||
|
||||
@ -3342,7 +3343,7 @@ begin
|
||||
readsymtable('elements',enumdef);
|
||||
delete(space,1,4);
|
||||
end;
|
||||
if tsystemcpu(ppufile.header.cpu)=cpu_jvm then
|
||||
if tsystemcpu(ppufile.header.common.cpu)=cpu_jvm then
|
||||
begin
|
||||
write([space,' Class def : ']);
|
||||
readderef('');
|
||||
@ -3681,13 +3682,13 @@ begin
|
||||
Writeln('-------');
|
||||
with ppufile.header do
|
||||
begin
|
||||
Writeln(['Compiler version : ',ppufile.header.compiler shr 14,'.',
|
||||
(ppufile.header.compiler shr 7) and $7f,'.',
|
||||
ppufile.header.compiler and $7f]);
|
||||
WriteLn(['Target processor : ',Cpu2Str(cpu)]);
|
||||
WriteLn(['Target operating system : ',Target2Str(target)]);
|
||||
Writeln(['Unit flags : ',PPUFlags2Str(flags)]);
|
||||
Writeln(['FileSize (w/o header) : ',size]);
|
||||
Writeln(['Compiler version : ',ppufile.header.common.compiler shr 14,'.',
|
||||
(ppufile.header.common.compiler shr 7) and $7f,'.',
|
||||
ppufile.header.common.compiler and $7f]);
|
||||
WriteLn(['Target processor : ',Cpu2Str(common.cpu)]);
|
||||
WriteLn(['Target operating system : ',Target2Str(common.target)]);
|
||||
Writeln(['Unit flags : ',PPUFlags2Str(common.flags)]);
|
||||
Writeln(['FileSize (w/o header) : ',common.size]);
|
||||
Writeln(['Checksum : ',hexstr(checksum,8)]);
|
||||
Writeln(['Interface Checksum : ',hexstr(interface_checksum,8)]);
|
||||
Writeln(['Indirect Checksum : ',hexstr(indirect_checksum,8)]);
|
||||
@ -3700,8 +3701,8 @@ begin
|
||||
begin
|
||||
CurUnit.Crc:=checksum;
|
||||
CurUnit.IntfCrc:=interface_checksum;
|
||||
CurUnit.TargetCPU:=Cpu2Str(cpu);
|
||||
CurUnit.TargetOS:=Target2Str(target);
|
||||
CurUnit.TargetCPU:=Cpu2Str(common.cpu);
|
||||
CurUnit.TargetOS:=Target2Str(common.target);
|
||||
end;
|
||||
|
||||
{read the general stuff}
|
||||
@ -3783,7 +3784,7 @@ begin
|
||||
Writeln('Implementation symtable');
|
||||
Writeln('----------------------');
|
||||
readsymtableoptions('implementation');
|
||||
if (ppufile.header.flags and uf_local_symtable)<>0 then
|
||||
if (ppufile.header.common.flags and uf_local_symtable)<>0 then
|
||||
begin
|
||||
if (verbose and v_defs)<>0 then
|
||||
begin
|
||||
|
@ -73,7 +73,8 @@ implementation
|
||||
uses
|
||||
globals,
|
||||
symdef,
|
||||
verbose;
|
||||
verbose,
|
||||
entfile;
|
||||
|
||||
procedure tunitwpoinfo.clearderefinfo;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user