From 54d3c26e27abce17bfe4db19cd8aa1e8c69b0b2b Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 5 Dec 2019 19:38:01 +0000 Subject: [PATCH] * renamed abi_linux386_sysv to abi_i386_dynalignedstack, and also use it for Darwin-based i386 platforms git-svn-id: trunk@43650 - --- compiler/i386/cpupi.pas | 2 +- compiler/ncgcal.pas | 2 +- compiler/ncgutil.pas | 2 +- compiler/systems.inc | 6 +++++- compiler/systems/i_bsd.pas | 4 ++-- compiler/systems/i_linux.pas | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/compiler/i386/cpupi.pas b/compiler/i386/cpupi.pas index c9f6af6b32..b5d704e907 100644 --- a/compiler/i386/cpupi.pas +++ b/compiler/i386/cpupi.pas @@ -92,7 +92,7 @@ unit cpupi; from the stack at the end of the procedure (in the "ret $xx"). If the stack is fixed, nothing has to be removed by the callee, except if a 16 byte aligned stack on i386-linux is used } - if paramanager.use_fixed_stack and not(target_info.abi=abi_linux386_sysv) then + if paramanager.use_fixed_stack and not(target_info.abi=abi_i386_dynalignedstack) then para_stack_size := 0; end; diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index 780fa0b7ac..91b5223562 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -1206,7 +1206,7 @@ implementation This does not apply to interrupt procedures, their ret statment never clears any stack parameters } else if paramanager.use_fixed_stack and not(po_interrupt in procdefinition.procoptions) and - (target_info.abi=abi_linux386_sysv) then + (target_info.abi=abi_i386_dynalignedstack) then begin { however, a delphi style frame pointer for a nested subroutine is not cleared by the callee, so we have to compensate for this diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index ebcf0dd965..c44a66e35b 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -776,7 +776,7 @@ implementation parasize:=current_procinfo.para_stack_size; { the parent frame pointer para has to be removed always by the caller in case of Delphi-style parent frame pointer passing } - if (not(paramanager.use_fixed_stack) or (target_info.abi=abi_linux386_sysv)) and + if (not(paramanager.use_fixed_stack) or (target_info.abi=abi_i386_dynalignedstack)) and (po_delphi_nested_cc in current_procinfo.procdef.procoptions) then dec(parasize,sizeof(pint)); end; diff --git a/compiler/systems.inc b/compiler/systems.inc index 8404998bad..e4c394c78b 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -321,7 +321,11 @@ ,abi_old_win32_gnu ,abi_aarch64_darwin ,abi_riscv_hf - ,abi_linux386_sysv + { stack is aligned and all room for parameters is reserved on + entry, but depending on the calling convention, the parameters + may still be removed by the callee (and then the stack needs to + be restored by the caller) } + ,abi_i386_dynalignedstack ); const diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas index 12bfa8f687..460f0c110e 100644 --- a/compiler/systems/i_bsd.pas +++ b/compiler/systems/i_bsd.pas @@ -874,7 +874,7 @@ unit i_bsd; first_parm_offset : 8; stacksize : 262144; stackalign : 16; - abi : abi_default; + abi : abi_i386_dynalignedstack; llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128'; ); @@ -943,7 +943,7 @@ unit i_bsd; first_parm_offset : 8; stacksize : 262144; stackalign : 16; - abi : abi_default; + abi : abi_i386_dynalignedstack; llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128'; ); diff --git a/compiler/systems/i_linux.pas b/compiler/systems/i_linux.pas index 0269e7b715..a09a3d3376 100644 --- a/compiler/systems/i_linux.pas +++ b/compiler/systems/i_linux.pas @@ -101,7 +101,7 @@ unit i_linux; first_parm_offset : 8; stacksize : 8*1024*1024; stackalign : 16; - abi : abi_linux386_sysv; + abi : abi_i386_dynalignedstack; { note: default LLVM stack alignment is 16 bytes for this target } llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32'; );