aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohannes Kliemann <kliemann@adacore.com>2024-10-23 14:07:07 +0000
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-11-12 14:00:49 +0100
commit0aeae8f645f087d455daf6bdc999eb2389bfc646 (patch)
tree4d9d4691b033e76f5bb48262dc72a1ed33624d92 /gcc
parent5f230267d241a199a6826c9c61f4e9b0a389c29b (diff)
downloadgcc-0aeae8f645f087d455daf6bdc999eb2389bfc646.zip
gcc-0aeae8f645f087d455daf6bdc999eb2389bfc646.tar.gz
gcc-0aeae8f645f087d455daf6bdc999eb2389bfc646.tar.bz2
ada: Set correct minimum stack size for aarch64-linux
The minimum stack size defined by PTHREAD_STACK_MIN defined on AArch64 Linux is 131072 bytes. Add a separate version for this target to reflect that value. Previously the x86-64 value of 16384 bytes was used. gcc/ada/ChangeLog: * Makefile.rtl: Use libgnat/s-parame__aarch64-linux.adb for s-parame.adb on aarch64-linux. * libgnat/s-parame__aarch64-linux.adb: Add file.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/Makefile.rtl1
-rw-r--r--gcc/ada/libgnat/s-parame__aarch64-linux.adb82
2 files changed, 83 insertions, 0 deletions
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 4d32bc4..d686a30 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2496,6 +2496,7 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
s-osinte.adb<libgnarl/s-osinte__posix.adb \
s-oslock.ads<libgnat/s-oslock__posix.ads \
s-osprim.adb<libgnat/s-osprim__posix.adb \
+ s-parame.adb<libgnat/s-parame__aarch64-linux.adb \
s-taprop.adb<libgnarl/s-taprop__linux.adb \
s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
diff --git a/gcc/ada/libgnat/s-parame__aarch64-linux.adb b/gcc/ada/libgnat/s-parame__aarch64-linux.adb
new file mode 100644
index 0000000..3985b41
--- /dev/null
+++ b/gcc/ada/libgnat/s-parame__aarch64-linux.adb
@@ -0,0 +1,82 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . P A R A M E T E R S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1995-2024, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the version for AArch64 Linux
+
+package body System.Parameters is
+
+ -------------------------
+ -- Adjust_Storage_Size --
+ -------------------------
+
+ function Adjust_Storage_Size (Size : Size_Type) return Size_Type is
+ begin
+ if Size = Unspecified_Size then
+ return Default_Stack_Size;
+ elsif Size < Minimum_Stack_Size then
+ return Minimum_Stack_Size;
+ else
+ return Size;
+ end if;
+ end Adjust_Storage_Size;
+
+ ------------------------
+ -- Default_Stack_Size --
+ ------------------------
+
+ function Default_Stack_Size return Size_Type is
+ Default_Stack_Size : constant Integer;
+ pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
+ begin
+ if Default_Stack_Size = -1 then
+ return 2 * 1024 * 1024;
+ elsif Size_Type (Default_Stack_Size) < Minimum_Stack_Size then
+ return Minimum_Stack_Size;
+ else
+ return Size_Type (Default_Stack_Size);
+ end if;
+ end Default_Stack_Size;
+
+ ------------------------
+ -- Minimum_Stack_Size --
+ ------------------------
+
+ function Minimum_Stack_Size return Size_Type is
+ begin
+ -- 12K is required for stack-checking to work reliably on most platforms
+ -- when using the GCC scheme to propagate an exception in the ZCX case.
+ -- 131K is the value of PTHREAD_STACK_MIN under AArch64 Linux, so is a
+ -- reasonable default.
+
+ return 128 * 1024;
+ end Minimum_Stack_Size;
+
+end System.Parameters;