Pārlūkot izejas kodu

* m68k has slightly different alignment requirements, so that aligntoptr might result in incorrect addresses for a record's element entries, thus we introduce a separate AlignTypeData function that handles this correctly

git-svn-id: trunk@42764 -
svenbarth 6 gadi atpakaļ
vecāks
revīzija
0c46460548
2 mainītis faili ar 11 papildinājumiem un 1 dzēšanām
  1. 1 1
      rtl/inc/rtti.inc
  2. 10 0
      rtl/inc/system.inc

+ 1 - 1
rtl/inc/rtti.inc

@@ -128,7 +128,7 @@ begin
 {$endif VER3_0}
 {$endif VER3_0}
   Count:=PRecordInfoInit(typeInfo)^.Count;
   Count:=PRecordInfoInit(typeInfo)^.Count;
   { Get element info, hacky, but what else can we do? }
   { Get element info, hacky, but what else can we do? }
-  typeInfo:=aligntoptr(Pointer(@PRecordInfoInit(typeInfo)^.Count)+SizeOf(PRecordInfoInit(typeInfo)^.Count));
+  typeInfo:=AlignTypeData(Pointer(@PRecordInfoInit(typeInfo)^.Count)+SizeOf(PRecordInfoInit(typeInfo)^.Count));
   { Process elements }
   { Process elements }
   for i:=1 to count Do
   for i:=1 to count Do
     begin
     begin

+ 10 - 0
rtl/inc/system.inc

@@ -458,6 +458,16 @@ function aligntoqword(p : pointer) : pointer;inline;
   end;
   end;
 
 
 
 
+function AlignTypeData(p : pointer) : pointer; inline;
+  begin
+{$if defined(CPUM68K) and not defined(VER3_0)}
+    result := aligntoqword(p);
+{$else CPUM68K and not VER3_0}
+    result := aligntoptr(p);
+{$endif CPUM68K and not VER3_0}
+  end;
+
+
 {$if not defined(VER3_0) and not defined(VER3_2)}
 {$if not defined(VER3_0) and not defined(VER3_2)}
 type
 type
   TRttiDataCommon =
   TRttiDataCommon =