From patchwork Thu Jul 13 19:17:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 120093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2036305vqm; Thu, 13 Jul 2023 12:18:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEudlPC4yg8budspd8m2djGb8bxhii8IvQn+n+nUjoeN0PXw/Gm2x6WggiZX6pgMENeUUid X-Received: by 2002:a17:907:7709:b0:991:bf04:204f with SMTP id kw9-20020a170907770900b00991bf04204fmr2051727ejc.60.1689275914622; Thu, 13 Jul 2023 12:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689275914; cv=none; d=google.com; s=arc-20160816; b=sHDr7LeZLMKeP03uu7LZMuKFBZGmWOzMQzSm4XLm2vOeaCMZRgzfuEeB4rq0PcbbA7 EE4KYsgBSmdD/N2E/jOHMsKE0iSMxt0f02YymJojslDDRqnQ3BIeY++ck4ihqo6g0Dg2 UY1+zLFyh5EN4LgjI3xbLsso135G3eHj3Jr5k4hovWKmkRk08BpGpMdYO98Y8CGQwdm3 uzDayTRs3SJLjfr8S2bbkEI584Wm4VGf1WXkwkk78p+6HFvCsNP5PifjIYuFTfmzBVin l3ybKorSjcQnfhgelQK3CDaCe8Jzo9cKqINOq67O52TzjXqfnjIQ058a8VHKay/1B84+ YDew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=VZRf5x2CCaPfbgwproeYV8OgRr0pptOMSNsIei8I6S4=; fh=Ft/BUqJHXOdrFpXBNZ2zPbTMn9lTzF9Uzs4Drq4Zu9Y=; b=fEVBKSkpDg92yhPeMa7syAjBm0e0fCeFz/fQzk5RSa6PJ5MLLTflrFdso+n5NEQeBH hzNKR5ggDS+pa9f7FnqIwj8usTwV5r2JnVsH2PAZ2LGapxYIOsgYS3PxVQ8j9xi8Y/qr 12arDle/XZNt+AP6lIhHy2K3Mn9OSZTuaxsdIYW6VyYTFpuIoxsrorfqbRILsKVO31As +3aPCxSHLAn8DEeOzV7CTFZG02gLZELwWnwDM5lbv03AaOHfwDsNRRqoTy7jMvwqoly+ ljO5Jqi93yDEb8dGe9tLwZmGmxt7x4JMaCK3rdv3dXPSUXpV6BbvRzP3BkHnyFwAn4Eb NoWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lmjQ63U+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o5-20020a170906358500b009930253bc63si7257737ejb.1024.2023.07.13.12.18.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 12:18:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lmjQ63U+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 368C53858415 for ; Thu, 13 Jul 2023 19:18:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 368C53858415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689275911; bh=VZRf5x2CCaPfbgwproeYV8OgRr0pptOMSNsIei8I6S4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=lmjQ63U+pJQLWV2vtYHEk6AC9zrA2k92Gn0gKgJi9ORUgHcH/C1DF79DMOh3F6HiN /uZN2v7U8fbcscyOlxg7ZXU3bqp7pWWRDUfZeyWh9Wbfyr8d9y9m8d4Edug8bIYcch drOm0tn0Th17IPS5rQboDZ4sTxEqCQiMgpGNM7uk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id EDD3C3858CDB for ; Thu, 13 Jul 2023 19:17:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EDD3C3858CDB Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbf1b82dc7so10225905e9.2 for ; Thu, 13 Jul 2023 12:17:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689275866; x=1691867866; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VZRf5x2CCaPfbgwproeYV8OgRr0pptOMSNsIei8I6S4=; b=XO+rx3PWTYyt/i02kiH8twPLQICnZK+24X1OwjDloov4DDlyToqU81xo6vuyvdBhX/ BnVqvs1Lg9fK894jM6ggho30sTwcT2mEer4TpTA025GgiYZ/EogbiJGSVLlxyfKy8ebx YkQS9vjhLfyPlsg/ZgoWLZqqWGtDhBRnujAhFbWoQbB/gWZofKQDFkT9N2T1N092R7Sp EgeVt1l80HFCgH0eLlwnKGvmorMQ+86HBqULP/m/4yO1ZCu5rYFv1mMNUos4cFszO3au ARufxOvNZ+yOOihCxM4oF4ZeID9axFx4y1l23KxyIEoYqpsdXA7dA5bsVmgkMW3Hdi8z dYlA== X-Gm-Message-State: ABy/qLY4EnKb/X92/IXbIo93WWhh4QITWGPgPYue9w57Iz8njZiCf/8z k8+2w7hf0VJrSUbz3CN9mxTQvxamxdE= X-Received: by 2002:a1c:7910:0:b0:3f9:82f:bad1 with SMTP id l16-20020a1c7910000000b003f9082fbad1mr2064397wme.40.1689275866403; Thu, 13 Jul 2023 12:17:46 -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 n2-20020a05600c294200b003fc17e8a1efsm8835000wmd.45.2023.07.13.12.17.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 13 Jul 2023 12:17:46 -0700 (PDT) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] Darwin: Use -platform_version when available [PR110624]. Date: Thu, 13 Jul 2023 20:17:44 +0100 Message-Id: <20230713191744.46960-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-Spam-Status: No, score=-8.4 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, 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: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771334181309109439 X-GMAIL-MSGID: 1771334181309109439 tested on i688, x86_64 Darwin versions with/without support for the platform_version flag. Checked by Rainer on macOS14. Pushed to trunk thanks, Iain --- 8< --- Later versions of the static linker support a more flexible flag to describe the OS, OS version and SDK used to build the code. This replaces the functionality of '-mmacosx_version_min' (which is now deprecated, leading to the diagnostic described in the PR). We now use the platform_version flag when available which avoids the diagnostic. Signed-off-by: Iain Sandoe PR target/110624 gcc/ChangeLog: * config/darwin.h (DARWIN_PLATFORM_ID): New. (LINK_COMMAND_A): Use DARWIN_PLATFORM_ID to pass OS, OS version and SDK data to the static linker. --- gcc/config/darwin.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 714d3d5cc0d..1b538c73593 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -276,6 +276,14 @@ extern GTY(()) int darwin_ms_struct; #define DARWIN_RDYNAMIC "%{rdynamic:%nrdynamic is not supported}" #endif +#if LD64_HAS_PLATFORM_VERSION +#define DARWIN_PLATFORM_ID \ + "%{mmacosx-version-min=*: -platform_version macos %* 0.0} " +#else +#define DARWIN_PLATFORM_ID \ + "%{mmacosx-version-min=*:-macosx_version_min %*} " +#endif + /* Code built with mdynamic-no-pic does not support PIE/PIC, so we disallow these combinations; we also ensure that the no_pie option is passed to ld64 on system versions that default to PIE when mdynamic-no-pic is given. @@ -351,7 +359,9 @@ extern GTY(()) int darwin_ms_struct; LINK_PLUGIN_SPEC \ "%{flto*:%