]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Add QNX specific version of System.Parameters
authorJohannes Kliemann <kliemann@adacore.com>
Wed, 29 Mar 2023 10:42:20 +0000 (10:42 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:18 +0000 (10:23 +0200)
The QNX runtimes used the default implementation of
System.Parameters that defines a default stack size
of 2 MB. The QNX specific version uses the QNX default
stack size of 256 KB instead.

gcc/ada/

* Makefile.rtl (QNX): Use s-parame__qnx.adb for s-parame.adb.
* libgnat/s-parame__qnx.adb: Add QNX specific version of
System.Parameters.

gcc/ada/Makefile.rtl
gcc/ada/libgnat/s-parame__qnx.adb [new file with mode: 0644]

index 2cfdd8dc613c01ef527c0ba07f6364fc9bb72e13..3da32fa66684b65a3cfbb1d28de879a6d16933f5 100644 (file)
@@ -1412,6 +1412,7 @@ ifeq ($(strip $(filter-out arm aarch64 %qnx,$(target_cpu) $(target_os))),)
   s-taspri.ads<libgnarl/s-taspri__posix.ads \
   s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
   g-soliop.ads<libgnat/g-soliop__qnx.ads \
+  s-parame.adb<libgnat/s-parame__qnx.adb \
   $(ATOMICS_TARGET_PAIRS) \
   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
   system.ads<libgnat/system-qnx-arm.ads
diff --git a/gcc/ada/libgnat/s-parame__qnx.adb b/gcc/ada/libgnat/s-parame__qnx.adb
new file mode 100644 (file)
index 0000000..d9b46b6
--- /dev/null
@@ -0,0 +1,81 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         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-2023, 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 QNX
+
+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
+         --  256K is the default stack size on aarch64 QNX
+         return 256 * 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
+      --  256 is the value of PTHREAD_STACK_MIN on QNX and
+      --  12K is required for stack-checking. The value is
+      --  rounded up to a multiple of a 4K page.
+      return 16 * 1024;
+   end Minimum_Stack_Size;
+
+end System.Parameters;