From patchwork Wed Jun 12 09:25:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1114391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502821-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Y6xRFMff"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45P1gh1vRxz9sBr for ; Wed, 12 Jun 2019 19:25:36 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ZB2ZjQw7a2uZtCsn LqFRnM7fB1eGgZ92HzkTZrjE16T2e1e79gaKBEAqS4gGOvZNwDBOPqCQ2B/6lLyI C/vRRU7QM1mDxGmodzQ6o3dwCwKEUaBGZhd2KxPJvRfDujm7Tq36Fl+W8oX4KbT9 Fc/cJgAk6+MDPQ05sf9vvUqUMUo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=wz4y8/czPRD64f0Enw2R7Z lBGl8=; b=Y6xRFMffQyst6JivLQWZyVE8HOLKfuqUdl7kwg9WQQamn/6EFf4TNL MsAkz2ZN82L9kS38tNcfXKNQ7R1ik5+eDorVtV/3B/RudGHoYcvvpa2zxJ3KJjGR eYHaCNF3wpDrOygqZjLI/d/HhQmVKAXk7UmSt0OF9hhF8oaa844lM= Received: (qmail 34221 invoked by alias); 12 Jun 2019 09:25:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 34212 invoked by uid 89); 12 Jun 2019 09:25:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Engineer, fighter, choosing, wild X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jun 2019 09:25:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4A26E56060; Wed, 12 Jun 2019 05:25:25 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RIRrBdT1LUYG; Wed, 12 Jun 2019 05:25:25 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id C591F5605F; Wed, 12 Jun 2019 05:25:24 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTP id x5C9PDcL084257; Wed, 12 Jun 2019 06:25:15 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Nick Clifton , Richard Earnshaw , Ramana Radhakrishnan , Kyrylo Tkachov Subject: [RFC] ARM -mfpu=auto woes Date: Wed, 12 Jun 2019 06:25:13 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 I'm looking into a regression between gcc-7 and gcc-8 that causes compilation with -mfloat-abi=hard to fail on arm-eabi with: $ arm-eabi-gcc -c -mfloat-abi=hard t.c cc1: error: -mfloat-abi=hard: selected processor lacks an FPU Per the documentation, -mfpu=auto was supposed to be the default, but the implicit -mcpu=armv7tdmi option from configure_default_options, or the -march=armv4t derived from it, seems to be taken as choosing to disable the fpu. Even passing -mfpu=auto explicitly one gets the error above; AFAICT it would only work if the default cpu had support for an fpu, and the "regression" is caused by new checks about conflicting options. Does that sound right? While trying to find a work-around, still suspecting the issue was a lack of -mfpu=auto, I tried configuring --with-fpu=auto and ran into a few issues. The first problem was a shell bug in the $fpu = error test: there must be a blank before the closing bracket. The second problem, hit after fixing the first, was that it printed a very confusing error message: Unknown target in --with-arch= which set me down a bit of a wild goose chase until I realized the error was about with_fpu, but the error message, presumably copied from an earlier loop, had not been adjusted for the fact that 'which' and 'val', set in the loop, were not set in the block below, and we don't want to print the values in the last iteration of the loop, we want the --with-fpu stuff. The third problem is that chkfpu rejects auto because auto is special, it's not in the fpu_cnames array. I'm not sure whether it's inappropriate to accept it, but if we could accept it so as to enable it to be an overriding default, it could be arranged to be explicitly accepted right in the portion of config.gcc modified by the patch below, or in parsecpu.awk. Any preferences? Weirdly, *without* the obvious fixes in the patch below, --with-fpu=auto is accepted, but after the patch it's no longer accepted, so I guess it might make sense to refrain from installing it until there's a decision as to whether --with-fpu=auto should be accepted. So, any objections to my installing this then, or even now, if --with-fpu=auto shouldn't be accepted? for gcc/ChangeLog * config.gcc: Fix ARM --with-fpu checking and error message. diff --git a/gcc/config.gcc b/gcc/config.gcc index 6b00c3872473..89ccbecec23d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -3962,12 +3962,13 @@ case "${target}" in # see if --with-fpu matches any of the supported FPUs if [ x"$with_fpu" != x ] ; then + val=$with_fpu fpu=`awk -f ${srcdir}/config/arm/parsecpu.awk \ - -v cmd="chkfpu $with_fpu" \ + -v cmd="chkfpu $val" \ ${srcdir}/config/arm/arm-cpus.in` - if [ "$fpu" = "error"] + if [ "$fpu" = "error" ] then - echo "Unknown target in --with-$which=$val" 1>&2 + echo "Unknown target in --with-fpu=$val" 1>&2 exit 1 fi fi