Browse Source

* for ARM CPU records must be aligned in stack depending of record size to prevent misaligned error when the record is passed as parameter in registers. It fixes tcalext* tests for ARM.

git-svn-id: trunk@7749 -
yury 18 years ago
parent
commit
206d027e9e
1 changed files with 12 additions and 1 deletions
  1. 12 1
      compiler/tgobj.pas

+ 12 - 1
compiler/tgobj.pas

@@ -117,7 +117,8 @@ implementation
     uses
     uses
        cutils,
        cutils,
        systems,verbose,
        systems,verbose,
-       procinfo
+       procinfo,
+       symconst
        ;
        ;
 
 
 
 
@@ -642,7 +643,17 @@ implementation
 
 
     procedure ttgobj.getlocal(list: TAsmList; size : longint; alignment : shortint; def:tdef;var ref : treference);
     procedure ttgobj.getlocal(list: TAsmList; size : longint; alignment : shortint; def:tdef;var ref : treference);
       begin
       begin
+{$ifdef arm}
+        { for ARM CPU records must be aligned in stack depending of record size           }
+        { to prevent misaligned error when the record is passed as parameter in registers }
+        if def.typ=recorddef then
+          if size>2 then
+            alignment:=current_settings.alignment.localalignmax
+          else
+            alignment:=size;
+{$else}
         alignment:=used_align(alignment,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax);
         alignment:=used_align(alignment,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax);
+{$endif arm}
         { can't use reference_reset_base, because that will let tgobj depend
         { can't use reference_reset_base, because that will let tgobj depend
           on cgobj (PFV) }
           on cgobj (PFV) }
         fillchar(ref,sizeof(ref),0);
         fillchar(ref,sizeof(ref),0);