From patchwork Mon May 29 08:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 70212 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 10920388265C for ; Mon, 29 May 2023 08:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10920388265C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349061; bh=o8zL0c/oNG+txH9sjev+ymHv1lg2FddYfbSTvapnbm8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PIfORpc6KjSCzP8/Dw1IpoyCsQMKigYFxejUM3CjbuGhg9ENrV0bIk3VI3fOxyJvi 8lm7WAYWk1pd4fivP/+dgXI9agSGIvStZlB0P1jTpaMErI8Y1X7Dr4EivF90Wwf1KG FCTTYSPTH7xNaZLgb+miDjfl+iH94oJtykfwrMb8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 3A3FE385734A for ; Mon, 29 May 2023 08:28:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A3FE385734A Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30af0aa4812so97012f8f.1 for ; Mon, 29 May 2023 01:28:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348936; x=1687940936; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o8zL0c/oNG+txH9sjev+ymHv1lg2FddYfbSTvapnbm8=; b=akifkGnuI7fOlKoHbPu/TBxkpsL45NMvs1A4d0pcmo5z6AAb1o6fyLyfUr69XDHnyu WWoBL9uTH9/FUcDSGyl6VT+zVHHhP/ivk/lwCJauqVTnPKBZPJwK2MQlCFzyWF53HqnJ 998fKNtuOZ85IU904aj6JSibhPBNzUkD2saCMBM7CiAGefCj4iMOJcJOUey0JHCBRvf7 Xmf6P2PWfq1ua2rsuPeKNqwQJdKUweGWo+dD3QS8b6A28YB8adIT49wxixcUohAkcG/E uOSCMvCE3XzY6nuaEDxaDm3TNt+ag18H8bUR+btStpZuTet6H0aNrowi5A/oLlCQZwIR lVRg== X-Gm-Message-State: AC+VfDz2oRV3UYu+haPDhA78Cit5317ehQEytwLG0NSdY18J/6Yas6m0 NvO8x7CViIy8jbnucjVEAV+eRE35dTCNRd3dsGBpYw== X-Google-Smtp-Source: ACHHUZ6z7I9nwjT+N9spVhk0q7FHIk/+GcCQE8aLPgjtO5t590NfYc/6q4cdabpQB14WwJ2T8hEOQw== X-Received: by 2002:a5d:4652:0:b0:2fe:e137:dbad with SMTP id j18-20020a5d4652000000b002fee137dbadmr7623547wrs.51.1685348936116; Mon, 29 May 2023 01:28:56 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id j10-20020a5d618a000000b0030631a599a0sm12951073wru.24.2023.05.29.01.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:28:55 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Johannes Kliemann Subject: [COMMITTED] ada: Add QNX specific version of System.Parameters Date: Mon, 29 May 2023 10:28:54 +0200 Message-Id: <20230529082854.2409155-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Johannes Kliemann 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. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/Makefile.rtl | 1 + gcc/ada/libgnat/s-parame__qnx.adb | 81 +++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 gcc/ada/libgnat/s-parame__qnx.adb diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 2cfdd8dc613..3da32fa6668 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -1412,6 +1412,7 @@ ifeq ($(strip $(filter-out arm aarch64 %qnx,$(target_cpu) $(target_os))),) s-taspri.ads. -- +-- -- +-- 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;