summaryrefslogtreecommitdiff
path: root/compiler/ptconst.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-01-21 23:28:34 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-01-21 23:28:34 +0000
commit1903b037de2fb3e75826406b46f055acb70963fa (patch)
tree604cd8b790fe14e5fbe441d4cd647c80d2a36a9a /compiler/ptconst.pas
parentad1141d52f8353457053b925cd674fe1d5c4eafc (diff)
parent953d907e4d6c3a5c2f8aaee6e5e4f73c55ce5985 (diff)
downloadfpc-blocks.tar.gz
* synchronised with trunk till r29513blocks
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/blocks@29516 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ptconst.pas')
-rw-r--r--compiler/ptconst.pas15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas
index b83bfad05d..cc2f0cc971 100644
--- a/compiler/ptconst.pas
+++ b/compiler/ptconst.pas
@@ -47,6 +47,7 @@ implementation
cursectype : TAsmSectionType;
section : ansistring;
tcbuilder : ttypedconstbuilder;
+ datalist,
reslist : tasmlist;
restree,
previnit : tnode;
@@ -64,13 +65,15 @@ implementation
if not(target_info.system in systems_typed_constants_node_init) then
begin
- if sym.varspez=vs_const then
+ maybe_new_object_file(list);
+ tcbuilder:=tasmlisttypedconstbuilderclass(ctypedconstbuilder).create(sym);
+ tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist(reslist,datalist);
+ { Certain types like windows WideString are initialized at runtime and cannot
+ be placed into readonly memory }
+ if (sym.varspez=vs_const) and not (vo_force_finalize in sym.varoptions) then
cursectype:=sec_rodata
else
cursectype:=sec_data;
- maybe_new_object_file(list);
- tcbuilder:=tasmlisttypedconstbuilderclass(ctypedconstbuilder).create(sym);
- reslist:=tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist;
tcbuilder.free;
end
else
@@ -87,6 +90,7 @@ implementation
current_module.tcinitcode:=restree;
tcbuilder.free;
reslist:=nil;
+ datalist:=nil;
cursectype:=sec_none;
end;
@@ -158,6 +162,9 @@ implementation
list.concatlist(reslist);
reslist.free;
list.concat(tai_symbol_end.Createname(sym.mangledname));
+ { and pointed data, if any }
+ current_asmdata.asmlists[al_const].concatlist(datalist);
+ datalist.free;
end
else
begin