浏览代码

* align stack properly if no stack frame is generated, should resolve #8986

git-svn-id: trunk@7611 -
florian 18 年之前
父节点
当前提交
fe69d19f9c
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 4 2
      compiler/x86/cgx86.pas
  2. 1 1
      compiler/x86_64/cgcpu.pas

+ 4 - 2
compiler/x86/cgx86.pas

@@ -1899,12 +1899,14 @@ unit cgx86;
 
 
             { allocate stackframe space }
             { allocate stackframe space }
             if (localsize<>0) or
             if (localsize<>0) or
-               ((target_info.system in [system_i386_darwin,system_x86_64_win64]) and
+               ((target_info.system in [system_i386_darwin,
+                 system_x86_64_win64,system_x86_64_linux,system_x86_64_freebsd]) and
                 (stackmisalignment <> 0) and
                 (stackmisalignment <> 0) and
                 ((pi_do_call in current_procinfo.flags) or
                 ((pi_do_call in current_procinfo.flags) or
                  (po_assembler in current_procinfo.procdef.procoptions))) then
                  (po_assembler in current_procinfo.procdef.procoptions))) then
               begin
               begin
-                if (target_info.system in [system_i386_darwin,system_x86_64_win64]) then
+                if (target_info.system in [system_i386_darwin,
+                      system_x86_64_win64,system_x86_64_linux,system_x86_64_freebsd]) then
                   localsize := align(localsize+stackmisalignment,16)-stackmisalignment;
                   localsize := align(localsize+stackmisalignment,16)-stackmisalignment;
                 cg.g_stackpointer_alloc(list,localsize);
                 cg.g_stackpointer_alloc(list,localsize);
                 if current_procinfo.framepointer=NR_STACK_POINTER_REG then
                 if current_procinfo.framepointer=NR_STACK_POINTER_REG then

+ 1 - 1
compiler/x86_64/cgcpu.pas

@@ -137,7 +137,7 @@ unit cgcpu;
             if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
             if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
               begin
               begin
                 stacksize:=current_procinfo.calc_stackframe_size;
                 stacksize:=current_procinfo.calc_stackframe_size;
-                if (target_info.system = system_x86_64_win64) and
+                if (target_info.system in [system_x86_64_win64,system_x86_64_linux,system_x86_64_freebsd]) and
                    ((stacksize <> 0) or
                    ((stacksize <> 0) or
                     (pi_do_call in current_procinfo.flags) or
                     (pi_do_call in current_procinfo.flags) or
                     { can't detect if a call in this case -> use nostackframe }
                     { can't detect if a call in this case -> use nostackframe }