From patchwork Wed Oct 27 18:34:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 46711 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 3E50F3858429 for ; Wed, 27 Oct 2021 18:35:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E50F3858429 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635359720; bh=Jkb8uHtqLHUDHefK+56HM4dghPZ0RyfMoQMt+5Wo+/4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=xEZyhxb/laoU5oYSSH2P38NWYoZhlLBOm+C36132oDHk1m0mjPIz3L2rA6lGYvYuC 3QOAuR07X0OAmQw+GNyYllUAkjixciFOKjRoe97iQb4RTRxuJDGD/vXCbj4xJzSDY8 bGovp8fFVoJuYO82f4zRUS5gc9ucAVyER7ZL10/U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 9B9D03858C27 for ; Wed, 27 Oct 2021 18:34:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B9D03858C27 Received: by mail-wm1-x331.google.com with SMTP id y205-20020a1c7dd6000000b0032cc8c2800fso6184059wmc.4 for ; Wed, 27 Oct 2021 11:34:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:reply-to :mime-version:content-transfer-encoding; bh=Jkb8uHtqLHUDHefK+56HM4dghPZ0RyfMoQMt+5Wo+/4=; b=NTrTu5mqOJ1Gb58gDGvUA6yV2GnHd+MBr7tA7/gtIOZ713CgoHhegvr1ZKbyoY1A5B BhpS6dKeIs+lLRUYnKlLxs+Gv5YIV0ReeZhRKojMgPGPitw1ZYhYDsao5JNqEpn/yRTq Xv770ldAA7BPWr/gxnXu7be/gN6Ym2csK0mBIGdiAGwbvnyjpFUIPn7Trf2r+d0AwpC1 cIeR6byZdfqK6kkYnJIXlVB9mfck3Bvbwpszc6nUUni+Bn1JPTLnPbcJxKkVPKUsQm92 QhicC9jF5UjlII4IXuCbw3WI2Q4WJjCYIqk3NAE4cSrfCGM8WM6osE9Z41KW4dxPggYI iPxQ== X-Gm-Message-State: AOAM530SnqgAqnvWrhadKt5BAq82HbE+qkPOD/sfUbOGq3YHUPtFby6g 0f7FcED1kMijFKuMbF9tsZ+/zvOZt80= X-Google-Smtp-Source: ABdhPJyRW0RFBbEbySBMuWgxIoC6H0CGjk1Oj0tnKU7qQhmelc8rGFXDV3hpiCAEvLRMpt6XHD1/3A== X-Received: by 2002:a1c:a557:: with SMTP id o84mr3405876wme.184.1635359689649; Wed, 27 Oct 2021 11:34:49 -0700 (PDT) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id n11sm600088wrs.14.2021.10.27.11.34.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Oct 2021 11:34:49 -0700 (PDT) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] Darwin, config: Amend for Darwin 21 / macOS 12. Date: Wed, 27 Oct 2021 19:34:42 +0100 Message-Id: <20211027183442.14661-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Saagar Jha Patch from the Arm64 Darwin branch, originally by Saagar Jha. It seems that the OS major version is now tracking the kernel major version - 9. Minor version has been set to kernel minor - 1 as for Darwin20. Tested on x86-64-darwin21, darwin20, darwin19, i686-darwin9, x86_64-linux-gnu. Pushed to master, thanks Iain Signed-off-by: Iain Sandoe Signed-off-by: Saagar Jha gcc/ChangeLog: * config.gcc: Adjust for Darwin21. * config/darwin-c.c (macosx_version_as_macro): Likewise. * config/darwin-driver.c (validate_macosx_version_min): Likewise. (darwin_find_version_from_kernel): Likewise. --- gcc/config.gcc | 6 +++--- gcc/config/darwin-c.c | 2 +- gcc/config/darwin-driver.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index efd1f42ac23..b1082cdbab1 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -681,9 +681,9 @@ case ${target} in *-*-darwin[4-9]* | *-*-darwin1[0-9]*) macos_min=`expr $darwin_maj - 4` ;; - *-*-darwin20*) - # Darwin 20 corresponds to macOS 11. - macos_maj=11 + *-*-darwin2*) + # Darwin 20 corresponds to macOS 11, Darwin 21 to macOS 12. + macos_maj=`expr $darwin_maj - 9` def_ld64=609.0 ;; *-*-darwin) diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 951a998775f..62d28fcea50 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -691,7 +691,7 @@ macosx_version_as_macro (void) if (!version_array) goto fail; - if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11) + if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12) goto fail; if (version_array[MAJOR] == 10 && version_array[MINOR] < 10) diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index a036e091c48..4f0c6bad61f 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -64,17 +64,17 @@ validate_macosx_version_min (const char *version_str) major = strtoul (version_str, &end, 10); - if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */ + if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */ return NULL; /* Skip a separating period, if there's one. */ version_str = end + ((*end == '.') ? 1 : 0); - if (major == 11 && *end != '\0' && !ISDIGIT (version_str[0])) - /* For MacOS 11, we allow just the major number, but if the minor is + if (major > 10 && *end != '\0' && !ISDIGIT (version_str[0])) + /* For macOS 11+, we allow just the major number, but if the minor is there it must be numeric. */ return NULL; - else if (major == 11 && *end == '\0') + else if (major > 10 && *end == '\0') /* We will rewrite 11 => 11.0.0. */ need_rewrite = true; else if (major == 10 && (*end == '\0' || !ISDIGIT (version_str[0]))) @@ -172,7 +172,7 @@ darwin_find_version_from_kernel (void) if (minor_vers > 0) minor_vers -= 1; /* Kernel 20.3 => macOS 11.2. */ /* It's not yet clear whether patch level will be considered. */ - asprintf (&new_flag, "11.%02d.00", minor_vers); + asprintf (&new_flag, "%d.%02d.00", major_vers - 9, minor_vers); } else if (major_vers - 4 <= 4) /* On 10.4 and earlier, the old linker is used which does not