Răsfoiți Sursa

* converted tnodeutils.InsertResourceInfo to the high level typed constant
builder and enabled it for llvm

git-svn-id: trunk@32532 -

Jonas Maebe 9 ani în urmă
părinte
comite
eefcbaff69
2 a modificat fișierele cu 19 adăugiri și 22 ștergeri
  1. 0 7
      compiler/llvm/nllvmutil.pas
  2. 19 15
      compiler/ngenutil.pas

+ 0 - 7
compiler/llvm/nllvmutil.pas

@@ -36,7 +36,6 @@ interface
      strict protected
      strict protected
       class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint); override;
       class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint); override;
      public
      public
-      class procedure InsertResourceInfo(ResourcesUsed : boolean); override;
       class procedure InsertObjectInfo; override;
       class procedure InsertObjectInfo; override;
     end;
     end;
 
 
@@ -69,12 +68,6 @@ implementation
     end;
     end;
 
 
 
 
-  class procedure tllvmnodeutils.InsertResourceInfo(ResourcesUsed: boolean);
-    begin
-      { not supported }
-    end;
-
-
   class procedure tllvmnodeutils.InsertObjectInfo;
   class procedure tllvmnodeutils.InsertObjectInfo;
     begin
     begin
       inherited;
       inherited;

+ 19 - 15
compiler/ngenutil.pas

@@ -1004,24 +1004,28 @@ implementation
   class procedure tnodeutils.InsertResourceInfo(ResourcesUsed: boolean);
   class procedure tnodeutils.InsertResourceInfo(ResourcesUsed: boolean);
     var
     var
       ResourceInfo : TAsmList;
       ResourceInfo : TAsmList;
+      tcb: ttai_typedconstbuilder;
     begin
     begin
       if (target_res.id in [res_elf,res_macho,res_xcoff]) then
       if (target_res.id in [res_elf,res_macho,res_xcoff]) then
         begin
         begin
-        ResourceInfo:=current_asmdata.asmlists[al_globals];
-
-        maybe_new_object_file(ResourceInfo);
-        new_section(ResourceInfo,sec_data,'FPC_RESLOCATION',sizeof(aint));
-        ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0));
-        if ResourcesUsed then
-          { Valid pointer to resource information }
-          ResourceInfo.concat(Tai_const.Createname('FPC_RESSYMBOL',0))
-        else
-          { Nil pointer to resource information }
-          {$IFNDEF cpu64bitaddr}
-          ResourceInfo.Concat(Tai_const.Create_32bit(0));
-          {$ELSE}
-          ResourceInfo.Concat(Tai_const.Create_64bit(0));
-          {$ENDIF}
+          tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
+
+          if ResourcesUsed then
+            tcb.emit_tai(Tai_const.Createname('FPC_RESSYMBOL',0),voidpointertype)
+          else
+            { Nil pointer to resource information }
+            tcb.emit_tai(tai_const.Create_nil_dataptr,voidpointertype);
+          current_asmdata.asmlists[al_globals].concatList(
+            tcb.get_final_asmlist(
+              current_asmdata.DefineAsmSymbol('FPC_RESLOCATION',AB_GLOBAL,AT_DATA),
+              voidpointertype,
+              sec_rodata,
+              'FPC_RESLOCATION',
+              sizeof(puint)
+            )
+          );
+
+          tcb.free;
         end;
         end;
     end;
     end;