Browse Source

* keep stack aligned when using profiler stubs

git-svn-id: trunk@38320 -
florian 7 years ago
parent
commit
92776e1864
2 changed files with 4 additions and 0 deletions
  1. 2 0
      rtl/linux/x86_64/gprt0.as
  2. 2 0
      rtl/linux/x86_64/si_g.inc

+ 2 - 0
rtl/linux/x86_64/gprt0.as

@@ -42,6 +42,7 @@ _start:
 	movq %rdx, %r9		/* Address of the shared library termination
 				   function.  */
 	popq %rsi		/* Pop the argument count.  */
+        pushq %rsi              /* keep stack aligned */
 	movq %rsp, %rdx		/* argv starts just at the current stack top.  */
 
         movq    entryinfo@GOTPCREL(%rip),%r10 /* load address of entryinfo variable */
@@ -142,6 +143,7 @@ _haltproc:
         movq    ___fpc_ret_rbp@GOTPCREL(%rip),%rcx
         movq    (%rcx),%rbp
         movq    ___fpc_ret@GOTPCREL(%rip),%rcx
+        popq    %rdx
         movq    (%rcx),%rdx
         pushq    %rdx
         ret

+ 2 - 0
rtl/linux/x86_64/si_g.inc

@@ -88,6 +88,7 @@ procedure ini_dummy;
     movq %rdx, %r9          { Address of the shared library termination
                              function.  }
     popq %rsi               { Pop the argument count.  }
+    pushq %rsi              { keep stack aligned }
     movq %rsp, %rdx         { argv starts just at the current stack top.  }
 
 {$ifdef FPC_HAS_INDIRECT_ENTRY_INFORMATION}
@@ -200,6 +201,7 @@ procedure main_stub; assembler; nostackframe;
 procedure _FPC_libc_haltproc(e:longint); assembler; nostackframe; public name '_haltproc';
   asm
     movl %edi,%eax
+    popq    %rdx                    { keep stack aligned }
     movq fpc_ret(%rip),%rdx         { return to libc }
     movq fpc_ret_rbp(%rip),%rbp
     pushq %rdx