Pārlūkot izejas kodu

* Don't place symbols with vo_force_finalize flag into read-only sections, resolves #26691.

git-svn-id: trunk@28626 -
sergei 11 gadi atpakaļ
vecāks
revīzija
8f1e058ac2
1 mainītis faili ar 6 papildinājumiem un 4 dzēšanām
  1. 6 4
      compiler/ptconst.pas

+ 6 - 4
compiler/ptconst.pas

@@ -64,13 +64,15 @@ implementation
 
         if not(target_info.system in systems_typed_constants_node_init) then
           begin
-            if sym.varspez=vs_const then
-              cursectype:=sec_rodata
-            else
-              cursectype:=sec_data;
             maybe_new_object_file(list);
             tcbuilder:=tasmlisttypedconstbuilderclass(ctypedconstbuilder).create(sym);
             reslist:=tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist;
+            { 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;
             tcbuilder.free;
           end
         else