From: Johannes Kliemann <kliem...@adacore.com> 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. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/Makefile.rtl | 1 + gcc/ada/libgnat/s-parame__aarch64-linux.adb | 82 +++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 gcc/ada/libgnat/s-parame__aarch64-linux.adb diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 4d32bc47185..d686a303ba7 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 00000000000..3985b414d26 --- /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; -- 2.43.0