mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
Omit FPC_INIT_FUNC_TABLE generation if no unit initialization is registered for current project.
This commit is contained in:
parent
677fd4fb00
commit
fc76d9fac2
@ -715,6 +715,7 @@ implementation
|
|||||||
nbas,ncon,nld,nmem,
|
nbas,ncon,nld,nmem,
|
||||||
ncgrtti,pass_2,
|
ncgrtti,pass_2,
|
||||||
cgobj,cutils,procinfo,
|
cgobj,cutils,procinfo,
|
||||||
|
ngenutil,
|
||||||
{$ifdef x86}
|
{$ifdef x86}
|
||||||
cgx86,
|
cgx86,
|
||||||
{$endif x86}
|
{$endif x86}
|
||||||
@ -4949,7 +4950,11 @@ implementation
|
|||||||
if not(current_module.islibrary) then
|
if not(current_module.islibrary) then
|
||||||
begin
|
begin
|
||||||
if tf_init_final_units_by_calls in target_info.flags then
|
if tf_init_final_units_by_calls in target_info.flags then
|
||||||
cg.a_call_name(list,'FPC_INIT_FUNC_TABLE',false)
|
begin
|
||||||
|
{ Only insert call if there are init functions }
|
||||||
|
if cnodeutils.has_init_list then
|
||||||
|
cg.a_call_name(list,'FPC_INIT_FUNC_TABLE',false);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
g_call_system_proc(list,'fpc_initializeunits',[],nil).resetiftemp;
|
g_call_system_proc(list,'fpc_initializeunits',[],nil).resetiftemp;
|
||||||
end
|
end
|
||||||
|
@ -134,6 +134,9 @@ interface
|
|||||||
|
|
||||||
class procedure InsertMemorySizes; virtual;
|
class procedure InsertMemorySizes; virtual;
|
||||||
|
|
||||||
|
{ Call this to check if init code is required }
|
||||||
|
class function has_init_list: boolean;
|
||||||
|
|
||||||
{ called right before an object is assembled, can be used to insert
|
{ called right before an object is assembled, can be used to insert
|
||||||
global information into the assembler list (used by LLVM to insert type
|
global information into the assembler list (used by LLVM to insert type
|
||||||
info) }
|
info) }
|
||||||
@ -1228,6 +1231,24 @@ implementation
|
|||||||
unitinits.free;
|
unitinits.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function tnodeutils.has_init_list: boolean;
|
||||||
|
var
|
||||||
|
hp : tused_unit;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
{ Check used units }
|
||||||
|
hp:=tused_unit(usedunits.first);
|
||||||
|
while assigned(hp) and (Result=false) do
|
||||||
|
begin
|
||||||
|
if mf_init in hp.u.moduleflags then
|
||||||
|
Result:=true;
|
||||||
|
hp:=tused_unit(hp.next);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Check current module }
|
||||||
|
Result:=Result or (mf_init in current_module.moduleflags);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
class procedure tnodeutils.InsertThreadvarTablesTable;
|
class procedure tnodeutils.InsertThreadvarTablesTable;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user