Browse Source

* ensure that the legacy method table has the correct alignment on platforms that require it (e.g. SPARC64)

Sven/Sarah Barth 1 year ago
parent
commit
170c05592b
3 changed files with 21 additions and 5 deletions
  1. 1 1
      compiler/ncgvmt.pas
  2. 10 2
      rtl/inc/objpas.inc
  3. 10 2
      rtl/objpas/typinfo.pp

+ 1 - 1
compiler/ncgvmt.pas

@@ -555,7 +555,7 @@ implementation
                   end;
                }
               tcb.start_internal_data_builder(current_asmdata.AsmLists[al_const],sec_rodata,_class.vmt_mangledname,lists.pubmethodstcb,lab);
-              get_tabledef(itp_vmt_intern_tmethodnametable,u32inttype,lists.methodnamerec,count,1,pubmethodsdef,pubmethodsarraydef);
+              get_tabledef(itp_vmt_intern_tmethodnametable,u32inttype,lists.methodnamerec,count,packrecords,pubmethodsdef,pubmethodsarraydef);
               { begin record ecompassing the tmethodnametable and the extended method table }
               lists.pubmethodstcb.begin_anonymous_record('',packrecords,
                   pubmethodsdef.alignment, targetinfos[target_info.system]^.alignment.recordalignmin);

+ 10 - 2
rtl/inc/objpas.inc

@@ -531,12 +531,20 @@ end;
       type
          {$PUSH}
          {$PACKRECORDS NORMAL}
-         tmethodnamerec = packed record
+         tmethodnamerec =
+         {$IFNDEF FPC_REQUIRES_PROPER_ALIGNMENT}
+         packed
+         {$ENDIF FPC_REQUIRES_PROPER_ALIGNMENT}
+         record
             name : pshortstring;
             addr : codepointer;
          end;
 
-         tmethodnametable = packed record
+         tmethodnametable =
+         {$IFNDEF FPC_REQUIRES_PROPER_ALIGNMENT}
+         packed
+         {$ENDIF FPC_REQUIRES_PROPER_ALIGNMENT}
+         record
            count : dword;
            entries : packed array[0..0] of tmethodnamerec;
          end;

+ 10 - 2
rtl/objpas/typinfo.pp

@@ -4826,12 +4826,20 @@ function TClassData.GetExMethodTable: PVmtMethodExTable;
 type
    {$push}
    {$packrecords normal}
-   tmethodnamerec = packed record
+   tmethodnamerec =
+   {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
+   packed
+   {$endif}
+   record
       name : pshortstring;
       addr : codepointer;
    end;
 
-   tmethodnametable = packed record
+   tmethodnametable =
+   {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
+   packed
+   {$endif}
+   record
      count : dword;
      entries : packed array[0..0] of tmethodnamerec;
    end;