From patchwork Fri Dec 17 09:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 49044 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 DC9093858418 for ; Fri, 17 Dec 2021 09:50:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC9093858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639734610; bh=tKX2E7ZfZm8CBWnZw5Ch/WWi6reoYuTkCbn6vXW/Q40=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=S+bg8Whd4SnVbPlE48UEkZfieMEIyY1iPXTlg8yjFY9WXm3EX+5NKMYV6+9GWGKLu c3RsaEitEXkZYOc5U+TJjEQzTet79fFjlg6oU8UMmP/9o1KmUz9TxSOPErNxCEgCLW zkx1eLy6S1xrGzAxpESJv9To5Ox3heFkMgmWasjA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id A42913858D35 for ; Fri, 17 Dec 2021 09:49:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A42913858D35 Received: by mail-wr1-x429.google.com with SMTP id a9so2911156wrr.8 for ; Fri, 17 Dec 2021 01:49:41 -0800 (PST) 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=tKX2E7ZfZm8CBWnZw5Ch/WWi6reoYuTkCbn6vXW/Q40=; b=zIpRke6kM9y+czVp63T1edyH3jL9O2LoeP0cAWyoDFWs/3YCfdQepq8Eow/ksKhNYp p8y9Wz1FbrRzcApnocXX1xNzp+k/fnfp7E3udwXMf+fhKsAIopY+AdbOVDrkl8Hgy0ra lID9FeMBu5inGl7y321/1m32JP16wIOWUkGzFY6g2ug+p84d1Y1QtDXQJXZ5wxUehps9 gN6g+amUisU7aIClBKHjHqh853D5XiyRb1SVm1SRWOPQEh2XAEw0fsf9KCEDiZ6wBJzv LlW4VFwySSUAo3TgGhcCtzLIgEImO+cNfszI37PRv1v5d1xiFcN/QrF8+t0sGC9s1T4t 17ug== X-Gm-Message-State: AOAM531lyngh+7QTTfNujJ4MLVwZafBcC9vJpdwwvX3J9EfiJRHjrFrT OyK1DejyTqjoEinYFN8NzcmbDabArhI= X-Google-Smtp-Source: ABdhPJzJNWzm7FPKxAflAbxrt33muqqSsuBVNSraywHcssXlBCre6nQ67vXPqNNAIMkIGNWdRHQVYw== X-Received: by 2002:adf:e109:: with SMTP id t9mr1707287wrz.387.1639734580721; Fri, 17 Dec 2021 01:49:40 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id l25sm4824376wmh.18.2021.12.17.01.49.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 01:49:40 -0800 (PST) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] Darwin, Driver: Avoid a link line for empty commands. Date: Fri, 17 Dec 2021 09:49:33 +0000 Message-Id: <20211217094933.38791-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" We were pushing a spec value for weak_reference_mismatches unconditionally which is not needed (the value was the default) and the side-effect of this was that we appeared to need to drive a link command; leading to unexpected diagnostics for cases where gcc was invoked with an empty command line. Also we were pushing flags for sysroot, os minimum version and controls even if the command line was empty. tested on x86_64, i686 and powerpc-darwin, pushed to master, thanks Iain Signed-off-by: Iain Sandoe gcc/ChangeLog: * config/darwin-driver.c (darwin_driver_init): Exit from the option handling early if the command line is definitely enpty. * config/darwin.h (SUBTARGET_DRIVER_SELF_SPECS): Remove setting for the default content of weak_reference_mismatches. --- gcc/config/darwin-driver.c | 8 ++++++-- gcc/config/darwin.h | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 7fa80abc314..688fe8fabc0 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -416,6 +416,10 @@ darwin_driver_init (unsigned int *decoded_options_count, } #endif + /* If there is nothing else on the command line, do not add sysroot etc. */ + if (*decoded_options_count <= 1) + return; + if (appendM32 || appendM64) { ++*decoded_options_count; @@ -426,7 +430,7 @@ darwin_driver_init (unsigned int *decoded_options_count, &(*decoded_options)[*decoded_options_count - 1]); } - if (! seen_sysroot_p) + if (!seen_sysroot_p) { /* We will pick up an SDKROOT if we didn't specify a sysroot and treat it as overriding any configure-time --with-sysroot. */ @@ -445,7 +449,7 @@ darwin_driver_init (unsigned int *decoded_options_count, /* We will need to know the OS X version we're trying to build for here so that we can figure out the mechanism and source for the sysroot to be used. */ - if (! seen_version_min && *decoded_options_count > 1) + if (!seen_version_min) /* Not set by the User, try to figure it out. */ vers_string = darwin_default_min_version (); diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 0ce13207ad6..75b688ebf9e 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -268,11 +268,6 @@ extern GTY(()) int darwin_ms_struct; "%{unexported_symbols_list*:\ -Xlinker -unexported_symbols_list -Xlinker %*} \ %