浏览代码

* fixed alignment of double, extended, int64 and qword on i386-darwin

git-svn-id: trunk@2870 -
Jonas Maebe 19 年之前
父节点
当前提交
659d3e106d
共有 2 个文件被更改,包括 28 次插入4 次删除
  1. 28 0
      compiler/symdef.pas
  2. 0 4
      compiler/symtable.pas

+ 28 - 0
compiler/symdef.pas

@@ -365,6 +365,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
           function  gettypename:string;override;
           function  gettypename:string;override;
+          function alignment:longint;override;
           procedure setsize;
           procedure setsize;
           function getvartype : longint;override;
           function getvartype : longint;override;
           { rtti }
           { rtti }
@@ -379,6 +380,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           function  gettypename:string;override;
           function  gettypename:string;override;
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
+          function alignment:longint;override;
           procedure setsize;
           procedure setsize;
           function  getvartype:longint;override;
           function  getvartype:longint;override;
           { rtti }
           { rtti }
@@ -1620,6 +1622,16 @@ implementation
       end;
       end;
 
 
 
 
+    function torddef.alignment:longint;
+      begin
+        if (target_info.system = system_i386_darwin) and
+           (typ in [s64bit,u64bit]) then
+          result := 4
+        else
+          result := inherited alignment;
+      end;
+
+
     procedure torddef.setsize;
     procedure torddef.setsize;
       const
       const
         sizetbl : array[tbasetype] of longint = (
         sizetbl : array[tbasetype] of longint = (
@@ -1786,6 +1798,22 @@ implementation
       end;
       end;
 
 
 
 
+    function tfloatdef.alignment:longint;
+      begin
+        if (target_info.system = system_i386_darwin) then
+          case typ of
+            s80real : result:=16;
+            s64real,
+            s64currency,
+            s64comp : result:=4;
+            else
+              result := inherited alignment;
+          end
+        else
+          result := inherited alignment;
+      end;
+
+
     procedure tfloatdef.setsize;
     procedure tfloatdef.setsize;
       begin
       begin
          case typ of
          case typ of

+ 0 - 4
compiler/symtable.pas

@@ -941,10 +941,6 @@ implementation
                 fieldalignment:=4
                 fieldalignment:=4
               else if (varalign>1) and (fieldalignment<2) then
               else if (varalign>1) and (fieldalignment<2) then
                 fieldalignment:=2;
                 fieldalignment:=2;
-              { darwin/x86 aligns long doubles on 16 bytes }
-              if (target_info.system = system_i386_darwin) and
-                  (fieldalignment = 12) then
-                fieldalignment := 16;
             end;
             end;
             fieldalignment:=min(fieldalignment,aktalignment.maxCrecordalign);
             fieldalignment:=min(fieldalignment,aktalignment.maxCrecordalign);
           end;
           end;