Переглянути джерело

* 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 роки тому
батько
коміт
0c46460548
2 змінених файлів з 11 додано та 1 видалено
  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}
   Count:=PRecordInfoInit(typeInfo)^.Count;
   { 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 }
   for i:=1 to count Do
     begin

+ 10 - 0
rtl/inc/system.inc

@@ -458,6 +458,16 @@ function aligntoqword(p : pointer) : pointer;inline;
   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)}
 type
   TRttiDataCommon =