21 lines
680 B
Diff
21 lines
680 B
Diff
--- a/rtl/linux/x86_64/si_c.inc
|
|
+++ b/rtl/linux/x86_64/si_c.inc
|
|
@@ -158,6 +158,7 @@ procedure _FPC_libc_haltproc; assembler;
|
|
movq ExitCode@GOTPCREL(%rip),%rax
|
|
movzwq (%rax),%rax { load and save exitcode }
|
|
|
|
+ popq %rdx { keep stack aligned }
|
|
movq fpc_ret(%rip),%rdx { return to libc }
|
|
movq fpc_ret_rbp(%rip),%rbp
|
|
pushq %rdx
|
|
--- a/rtl/linux/x86_64/cprt0.as
|
|
+++ b/rtl/linux/x86_64/cprt0.as
|
|
@@ -111,6 +111,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
|