mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 19:19:24 +02:00
Generate indirect symbols for global variables and (typed) constants.
Note: It needs to be checked what adjustments will need to be done for JVM and LLVM Note 2: The indirect symbols will always be generated even if the target won't use them so that assembler code can be consistent among the targets (e.g. i386-win32 needs them while i386-linux does not) ptconst.pas, read_typed_const: * generate the indirect symbol in a read only data section ngenutil.pas, tnodeutils: * insertbsssym: generate the indirect symbol in a read only data section git-svn-id: trunk@33279 -
This commit is contained in:
parent
3971ba7898
commit
6722c611cf
@ -562,6 +562,8 @@ implementation
|
||||
|
||||
|
||||
class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint);
|
||||
var
|
||||
symind : tasmsymbol;
|
||||
begin
|
||||
if sym.globalasmsym then
|
||||
begin
|
||||
@ -581,6 +583,13 @@ implementation
|
||||
end
|
||||
else
|
||||
list.concat(Tai_datablock.create(sym.mangledname,size));
|
||||
|
||||
{ add the indirect symbol if needed }
|
||||
new_section(list,sec_rodata,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
|
||||
list.concat(Tai_symbol.Create_Global(symind,0));
|
||||
list.concat(Tai_const.Createname(sym.mangledname,AT_DATA,0));
|
||||
list.concat(tai_symbol_end.Create(symind));
|
||||
end;
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ implementation
|
||||
datalist : tasmlist;
|
||||
restree,
|
||||
previnit : tnode;
|
||||
symind : tasmsymbol;
|
||||
begin
|
||||
{ mark the staticvarsym as typedconst }
|
||||
include(sym.varoptions,vo_is_typed_const);
|
||||
@ -133,6 +134,14 @@ implementation
|
||||
{ and pointed data, if any }
|
||||
current_asmdata.asmlists[al_const].concatlist(datalist);
|
||||
{ the (empty) lists themselves are freed by tcbuilder }
|
||||
|
||||
{ add indirect symbol }
|
||||
{ ToDo: do we also need this for the else part? }
|
||||
new_section(list,sec_rodata,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
||||
symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
|
||||
list.concat(Tai_symbol.Create_Global(symind,0));
|
||||
list.concat(Tai_const.Createname(sym.mangledname,AT_DATA,0));
|
||||
list.concat(tai_symbol_end.Create(symind));
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user