From ec6a6a6bb5bb30ca1821c9df312893ec9bd52d26 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 30 Mar 2022 08:14:09 +0200 Subject: Add chkstk-x64 for windows x64 --- src/ortho/mcode/ortho_code-x86-abi.adb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/ortho/mcode') diff --git a/src/ortho/mcode/ortho_code-x86-abi.adb b/src/ortho/mcode/ortho_code-x86-abi.adb index 44c435de2..0bba430a0 100644 --- a/src/ortho/mcode/ortho_code-x86-abi.adb +++ b/src/ortho/mcode/ortho_code-x86-abi.adb @@ -846,7 +846,12 @@ package body Ortho_Code.X86.Abi is procedure Chkstk (Sz : Integer); pragma Import (C, Chkstk, "__chkstk"); - procedure Link_Intrinsics is + procedure Chkstk_Ms (Sz : Integer); + pragma Import (C, Chkstk_Ms, "__chkstk_ms"); + + procedure Link_Intrinsics + is + Addr : System.Address; begin if not Flags.M64 then Binary_File.Memory.Set_Symbol_Address @@ -863,8 +868,13 @@ package body Ortho_Code.X86.Abi is Moddi3'Address); end if; if X86.Flags.Flag_Alloca_Call then + if Flags.Win64 then + Addr := Chkstk_Ms'Address; + else + Addr := Chkstk'Address; + end if; Binary_File.Memory.Set_Symbol_Address - (Ortho_Code.X86.Emits.Chkstk_Symbol, Chkstk'Address); + (Ortho_Code.X86.Emits.Chkstk_Symbol, Addr); end if; end Link_Intrinsics; -- cgit v1.2.3