mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 12:39:24 +02:00
* converted tnodeutils.InsertMemorySizes() to the high level typed constant
builder and activated it for llvm git-svn-id: trunk@31678 -
This commit is contained in:
parent
fa7ebba80d
commit
f8d9e70ec2
@ -38,7 +38,6 @@ interface
|
|||||||
public
|
public
|
||||||
class procedure InsertResourceTablesTable; override;
|
class procedure InsertResourceTablesTable; override;
|
||||||
class procedure InsertResourceInfo(ResourcesUsed : boolean); override;
|
class procedure InsertResourceInfo(ResourcesUsed : boolean); override;
|
||||||
class procedure InsertMemorySizes; override;
|
|
||||||
class procedure InsertObjectInfo; override;
|
class procedure InsertObjectInfo; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -83,12 +82,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
class procedure tllvmnodeutils.InsertMemorySizes;
|
|
||||||
begin
|
|
||||||
{ not required }
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
class procedure tllvmnodeutils.InsertObjectInfo;
|
class procedure tllvmnodeutils.InsertObjectInfo;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -1014,22 +1014,36 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
class procedure tnodeutils.InsertMemorySizes;
|
class procedure tnodeutils.InsertMemorySizes;
|
||||||
{$IFDEF POWERPC}
|
|
||||||
var
|
var
|
||||||
stkcookie: string;
|
tcb: ttai_typedconstbuilder;
|
||||||
{$ENDIF POWERPC}
|
s: shortstring;
|
||||||
|
sym: tasmsymbol;
|
||||||
|
def: tdef;
|
||||||
begin
|
begin
|
||||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
|
||||||
{ Insert Ident of the compiler in the .fpc.version section }
|
{ Insert Ident of the compiler in the .fpc.version section }
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_fpc,'version',const_align(32));
|
tcb:=ctai_typedconstbuilder.create([tcalo_no_dead_strip]);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_string.Create('FPC '+full_version_string+
|
s:='FPC '+full_version_string+
|
||||||
' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname));
|
' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname;
|
||||||
|
def:=carraydef.getreusable(cansichartype,length(s));
|
||||||
|
tcb.maybe_begin_aggregate(def);
|
||||||
|
tcb.emit_tai(Tai_string.Create(s),def);
|
||||||
|
tcb.maybe_end_aggregate(def);
|
||||||
|
sym:=current_asmdata.DefineAsmSymbol('__fpc_ident',AB_LOCAL,AT_DATA);
|
||||||
|
current_asmdata.asmlists[al_globals].concatlist(
|
||||||
|
tcb.get_final_asmlist(sym,def,sec_fpc,'version',const_align(32))
|
||||||
|
);
|
||||||
|
tcb.free;
|
||||||
|
|
||||||
if not(tf_no_generic_stackcheck in target_info.flags) then
|
if not(tf_no_generic_stackcheck in target_info.flags) then
|
||||||
begin
|
begin
|
||||||
{ stacksize can be specified and is now simulated }
|
{ stacksize can be specified and is now simulated }
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'__stklen', sizeof(pint));
|
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,sizeof(pint)));
|
tcb.emit_tai(Tai_const.Create_pint(stacksize),ptruinttype);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_pint(stacksize));
|
sym:=current_asmdata.DefineAsmSymbol('__stklen',AB_GLOBAL,AT_DATA);
|
||||||
|
current_asmdata.asmlists[al_globals].concatlist(
|
||||||
|
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__stklen',sizeof(pint))
|
||||||
|
);
|
||||||
|
tcb.free;
|
||||||
end;
|
end;
|
||||||
{$IFDEF POWERPC}
|
{$IFDEF POWERPC}
|
||||||
{ AmigaOS4 "stack cookie" support }
|
{ AmigaOS4 "stack cookie" support }
|
||||||
@ -1038,33 +1052,48 @@ implementation
|
|||||||
{ this symbol is needed to ignite powerpc amigaos' }
|
{ this symbol is needed to ignite powerpc amigaos' }
|
||||||
{ stack allocation magic for us with the given stack size. }
|
{ stack allocation magic for us with the given stack size. }
|
||||||
{ note: won't work for m68k amigaos or morphos. (KB) }
|
{ note: won't work for m68k amigaos or morphos. (KB) }
|
||||||
str(stacksize,stkcookie);
|
str(stacksize,s);
|
||||||
stkcookie:='$STACK: '+stkcookie+#0;
|
s:='$STACK: '+s+#0;
|
||||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
def:=carraydef.getreusable(cansichartype,length(s));
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'__stack_cookie',length(stkcookie));
|
tcb:=ctai_typedconstbuilder.create([tcalo_new_section]);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__stack_cookie',AT_DATA,length(stkcookie)));
|
tcb.maybe_begin_aggregate(def);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_string.Create(stkcookie));
|
tcb.emit_tai(Tai_string.Create(s),def);
|
||||||
|
tcb.maybe_end_aggregate(def);
|
||||||
|
sym:=current_asmdata.DefineAsmSymbol('__stack_cookie',AB_GLOBAL,AT_DATA);
|
||||||
|
current_asmdata.asmlists[al_globals].concatlist(
|
||||||
|
tcb.get_final_asmlist(sym,def,sec_data,'__stack_cookie',sizeof(pint))
|
||||||
|
);
|
||||||
|
tcb.free;
|
||||||
end;
|
end;
|
||||||
{$ENDIF POWERPC}
|
{$ENDIF POWERPC}
|
||||||
{ Initial heapsize }
|
{ Initial heapsize }
|
||||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'__heapsize',const_align(sizeof(pint)));
|
tcb.emit_tai(Tai_const.Create_pint(heapsize),ptruinttype);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__heapsize',AT_DATA,sizeof(pint)));
|
sym:=current_asmdata.DefineAsmSymbol('__heapsize',AB_GLOBAL,AT_DATA);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_pint(heapsize));
|
current_asmdata.asmlists[al_globals].concatlist(
|
||||||
|
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__heapsize',sizeof(pint))
|
||||||
|
);
|
||||||
|
tcb.free;
|
||||||
|
|
||||||
{ allocate an initial heap on embedded systems }
|
{ allocate an initial heap on embedded systems }
|
||||||
if target_info.system in systems_embedded then
|
if target_info.system in systems_embedded then
|
||||||
begin
|
begin
|
||||||
|
{ tai_datablock cannot yet be handled via the high level typed const
|
||||||
|
builder, because it implies the generation of a symbol, while this
|
||||||
|
is separate in the builder }
|
||||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_bss,'__fpc_initialheap',current_settings.alignment.varalignmax);
|
new_section(current_asmdata.asmlists[al_globals],sec_bss,'__fpc_initialheap',current_settings.alignment.varalignmax);
|
||||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize));
|
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Valgrind usage }
|
{ Valgrind usage }
|
||||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_data,'__fpc_valgrind',const_align(sizeof(pint)));
|
tcb.emit_ord_const(byte(cs_gdb_valgrind in current_settings.globalswitches),u8inttype);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__fpc_valgrind',AT_DATA,sizeof(boolean)));
|
sym:=current_asmdata.DefineAsmSymbol('__fpc_valgrind',AB_GLOBAL,AT_DATA);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.create_8bit(byte(cs_gdb_valgrind in current_settings.globalswitches)));
|
current_asmdata.asmlists[al_globals].concatlist(
|
||||||
|
tcb.get_final_asmlist(sym,ptruinttype,sec_data,'__fpc_valgrind',sizeof(pint))
|
||||||
|
);
|
||||||
|
tcb.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user