* be able to set an AT_* for datablocks

* set AT_TLS if needed

git-svn-id: trunk@43076 -
This commit is contained in:
florian 2019-09-25 21:19:07 +00:00
parent 11319353fd
commit 3949be6989
4 changed files with 23 additions and 20 deletions

View File

@ -637,9 +637,9 @@ interface
is_global : boolean;
sym : tasmsymbol;
size : asizeint;
constructor Create(const _name : string;_size : asizeint; def: tdef);
constructor Create_hidden(const _name : string;_size : asizeint; def: tdef);
constructor Create_global(const _name : string;_size : asizeint; def: tdef);
constructor Create(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
constructor Create_hidden(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
constructor Create_global(const _name: string; _size: asizeint; def: tdef; _typ: Tasmsymtype);
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
procedure derefimpl;override;
@ -1284,12 +1284,12 @@ implementation
TAI_DATABLOCK
****************************************************************************}
constructor tai_datablock.Create(const _name : string;_size : asizeint; def: tdef);
constructor tai_datablock.Create(const _name : string;_size : asizeint; def: tdef; _typ:Tasmsymtype);
begin
inherited Create;
typ:=ait_datablock;
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,AT_DATA,def);
sym:=current_asmdata.DefineAsmSymbol(_name,AB_LOCAL,_typ,def);
{ keep things aligned }
if _size<=0 then
_size:=sizeof(aint);
@ -1297,13 +1297,13 @@ implementation
is_global:=false;
end;
constructor tai_datablock.Create_hidden(const _name: string; _size: asizeint; def: tdef);
constructor tai_datablock.Create_hidden(const _name: string; _size: asizeint; def: tdef; _typ:Tasmsymtype);
begin
if tf_supports_hidden_symbols in target_info.flags then
begin
inherited Create;
typ:=ait_datablock;
sym:=current_asmdata.DefineAsmSymbol(_name,AB_PRIVATE_EXTERN,AT_DATA,def);
sym:=current_asmdata.DefineAsmSymbol(_name,AB_PRIVATE_EXTERN,_typ,def);
{ keep things aligned }
if _size<=0 then
_size:=sizeof(aint);
@ -1311,15 +1311,15 @@ implementation
is_global:=true;
end
else
Create(_name,_size,def);
Create(_name,_size,def,_typ);
end;
constructor tai_datablock.Create_global(const _name : string;_size : asizeint; def: tdef);
constructor tai_datablock.Create_global(const _name : string;_size : asizeint; def: tdef; _typ:Tasmsymtype);
begin
inherited Create;
typ:=ait_datablock;
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,AT_DATA,def);
sym:=current_asmdata.DefineAsmSymbol(_name,AB_GLOBAL,_typ,def);
{ keep things aligned }
if _size<=0 then
_size:=sizeof(aint);

View File

@ -76,7 +76,7 @@ implementation
while stacksizeleft>0 do
begin
stackblock:=min(stacksizeleft,high(aint));
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock,carraydef.getreusable(u8inttype,stackblock)));
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock,carraydef.getreusable(u8inttype,stackblock),AT_DATA));
dec(stacksizeleft,stackblock);
inc(i);
end;
@ -101,7 +101,7 @@ implementation
while heapsizeleft>0 do
begin
heapblock:=min(heapsizeleft,high(aint));
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock,carraydef.getreusable(u8inttype,heapblock)));
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___heapblock'+IntToStr(i),heapblock,carraydef.getreusable(u8inttype,heapblock),AT_DATA));
dec(heapsizeleft,heapblock);
inc(i);
end;

View File

@ -102,7 +102,7 @@ interface
class procedure trash_large(var stat: tstatementnode; trashn, sizen: tnode; trashintval: int64); virtual;
{ insert a single bss sym, called by insert bssdata (factored out
non-common part for llvm) }
class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint); virtual;
class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint; _typ: Tasmsymtype); virtual;
{ initialization of iso styled program parameters }
class procedure initialize_textrec(p : TObject; statn : pointer);
@ -854,7 +854,7 @@ implementation
end;
class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint);
class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint; _typ:Tasmsymtype);
begin
if sym.globalasmsym then
begin
@ -870,10 +870,10 @@ implementation
list.concat(tai_symbol.Create(current_asmdata.DefineAsmSymbol(sym.name,AB_LOCAL,AT_DATA,sym.vardef),0));
list.concat(tai_directive.Create(asd_reference,sym.name));
end;
list.concat(Tai_datablock.create_global(sym.mangledname,size,sym.vardef));
list.concat(Tai_datablock.create_global(sym.mangledname,size,sym.vardef,_typ));
end
else
list.concat(Tai_datablock.create_hidden(sym.mangledname,size,sym.vardef));
list.concat(Tai_datablock.create_hidden(sym.mangledname,size,sym.vardef,_typ));
end;
@ -884,6 +884,7 @@ implementation
storefilepos : tfileposinfo;
list : TAsmList;
sectype : TAsmSectiontype;
asmtype: TAsmsymtype;
begin
storefilepos:=current_filepos;
current_filepos:=sym.fileinfo;
@ -893,12 +894,14 @@ implementation
varalign:=var_align_size(l)
else
varalign:=var_align(varalign);
asmtype:=AT_DATA;
if tf_section_threadvars in target_info.flags then
begin
if (vo_is_thread_var in sym.varoptions) then
begin
list:=current_asmdata.asmlists[al_threadvars];
sectype:=sec_threadvar;
asmtype:=AT_TLS;
end
else
begin
@ -924,7 +927,7 @@ implementation
new_section(list,sec_user,sym.section,varalign)
else
new_section(list,sectype,lower(sym.mangledname),varalign);
insertbsssym(list,sym,l,varalign);
insertbsssym(list,sym,l,varalign,asmtype);
current_filepos:=storefilepos;
end;
@ -1536,7 +1539,7 @@ implementation
is separate in the builder }
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
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,carraydef.getreusable(u8inttype,heapsize)));
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_initialheap',heapsize,carraydef.getreusable(u8inttype,heapsize),AT_DATA));
end;
{ Valgrind usage }

View File

@ -1254,7 +1254,7 @@ unit raatt;
Consume(AS_ID);
Consume(AS_COMMA);
symofs:=BuildConstExpression(false,false);
curList.concat(Tai_datablock.Create(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
curList.concat(Tai_datablock.Create(commname,symofs,carraydef.getreusable(u8inttype,symofs),AT_DATA));
if actasmtoken<>AS_SEPARATOR then
Consume(AS_SEPARATOR);
end;
@ -1266,7 +1266,7 @@ unit raatt;
Consume(AS_ID);
Consume(AS_COMMA);
symofs:=BuildConstExpression(false,false);
curList.concat(Tai_datablock.Create_global(commname,symofs,carraydef.getreusable(u8inttype,symofs)));
curList.concat(Tai_datablock.Create_global(commname,symofs,carraydef.getreusable(u8inttype,symofs),AT_DATA));
if actasmtoken<>AS_SEPARATOR then
Consume(AS_SEPARATOR);
end;