From patchwork Thu May 12 22:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 53879 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 BD02C385E010 for ; Thu, 12 May 2022 22:29:11 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 0981E3850435 for ; Thu, 12 May 2022 22:28:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0981E3850435 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32b.google.com with SMTP id k126-20020a1ca184000000b003943fd07180so3790831wme.3 for ; Thu, 12 May 2022 15:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=3xicBXTFQ4AdGa4Og/fMMZp43Fq75WRyPvgRz98F3hs=; b=JJmH0TJMII9si6Aeuhe6PnxJxFxzh8TC9qsMVekNPpifjoEbkd/a8ckX4mukY5Q8lW ir+tRkSYXPYQrbudkZ9jjRBx8iuPevHF5Bw8iKrN+IGnbk5Mve1lGJYDzHupBb0UQwa7 PVJqZB3omZRLzc6+mOr7e/xzT/7XAdDepIxmbCqQWcrpoIIyo4CXfAtIGHKsrp3xbQe2 Ygf8YCesKlBgOh04IKEW0iMxq7D0lKRxd1YIW0ZGWIfXIPivzZgFZc/cSbQIcucv1T4m kA+2XG34+R90ZB7Vgz7uIep2tz0Lqn0Vp2f/T0EYB930oVpuf7NBMALQhXThRYvMAhtA qnrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=3xicBXTFQ4AdGa4Og/fMMZp43Fq75WRyPvgRz98F3hs=; b=o8sqBvMJk8NnZbLcPzzWSp5cGwIxT8Eae/U74o4Iwg3c/NXnpmjbCRreU5GX7uqGuB 8+0U+/PjHYccgHfjjCLiUq7jCr3lOWiIlvUvNLzGkIkagM6RGtBbotVjno+S/rsjRB5l g59HhlkBy7/eXe4jQnszbGwbEIk6MaF2hZe0Ir3lIvSbhr/x3q6wA94SVPZ8kkdUVojf 6/kYbIrv75cQEXzn2JE7inri35j0vI3cmzXWbnuS9ruoeresNfWK3YcJiEErj6qnI/Uz Jw7AJj8pkeQwMShThIE3rcevlnW4e45czzuetPlYrsVwNHHQPaErkWSz6+gSw/F9Kp4n t5Wg== X-Gm-Message-State: AOAM532lRMKYeBTHh54k+aO0fbIjbFlwZfPpuUh4uXbaN3p5addslRVX RCR3kUhcir/eFEmYEc9YRVPmJA7HKmnug5Y3 X-Google-Smtp-Source: ABdhPJxDDvbUgi6YEedlXIIEEdxzcnKJcpkhmj3PlvFQq+byTWkM9+qy0OjArShVa6qh+oKC29SKFg== X-Received: by 2002:a05:600c:35c6:b0:394:856d:fb07 with SMTP id r6-20020a05600c35c600b00394856dfb07mr1760988wmq.131.1652394526894; Thu, 12 May 2022 15:28:46 -0700 (PDT) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id p15-20020a7bcdef000000b00394517e7d98sm737709wmj.25.2022.05.12.15.28.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 15:28:46 -0700 (PDT) Date: Thu, 12 May 2022 23:28:45 +0100 (BST) From: "Maciej W. Rozycki" To: libc-alpha@sourceware.org Subject: [PATCH v2 1/4] C-SKY: Use an autoconf template to produce `preconfigure' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Waterman , Mao Han , Andreas Schwab , Joseph Myers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Avoid fiddling with autoconf internals and use AC_DEFINE_UNQUOTED to define macros in the configuration headers rather than handcoding an equivalent shell sequence with the use of the `as_echo' undocumented variable. Switch to using AC_MSG_ERROR rather than `echo' and `exit' directly for error handling. Owing to the lack of any kind of error annotation it makes it difficult to spot the message in the flood in a parallel build and neither it is logged in `config.log'. --- New change in v2. --- sysdeps/csky/preconfigure | 27 +++++++++++++-------- sysdeps/csky/preconfigure.ac | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 10 deletions(-) glibc-csky-preconfigure-as-fn-error.diff Index: glibc/sysdeps/csky/preconfigure =================================================================== --- glibc.orig/sysdeps/csky/preconfigure +++ glibc/sysdeps/csky/preconfigure @@ -1,3 +1,6 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! +# Local preconfigure fragment for sysdeps/csky + case "$machine" in csky*) abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | @@ -11,16 +14,14 @@ csky*) case "$abi" in 1) - echo "glibc does not support abiv1 yet" >&2 - exit 1 - ;; + as_fn_error 1 "glibc does not support abiv1 yet" "$LINENO" 5 + ;; 2) - machine=abiv2 - ;; + machine=abiv2 + ;; *) - echo "Unknown abi" >&2 - exit 1 - ;; + as_fn_error 1 "Unknown abi" "$LINENO" 5 + ;; esac # __CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether @@ -48,7 +49,13 @@ csky*) base_machine=csky machine=csky/$machine - $as_echo "#define CSKYABI $abi" >>confdefs.h - $as_echo "#define CSKY_HARD_FLOAT $with_fp_cond" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define CSKYABI $abi +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define CSKY_HARD_FLOAT $with_fp_cond +_ACEOF + ;; esac Index: glibc/sysdeps/csky/preconfigure.ac =================================================================== --- /dev/null +++ glibc/sysdeps/csky/preconfigure.ac @@ -0,0 +1,55 @@ +GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/csky + +case "$machine" in +csky*) + abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'` + hard_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define __CSKY_HARD_FLOAT__ \(.*\)/\1/p'` + hard_float_sf=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define __CSKY_HARD_FLOAT_FPU_SF__ \(.*\)/\1/p'` + hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'` + + case "$abi" in + 1) + AC_MSG_ERROR([glibc does not support abiv1 yet], [1]) + ;; + 2) + machine=abiv2 + ;; + *) + AC_MSG_ERROR([Unknown abi], [1]) + ;; + esac + + # __CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether + # -mfloat-abi=hard is set. On older gcc, the float ABI is defined solely + # with __CSKY_HARD_FLOAT__. If __CSKY_HARD_FLOAT__ is set, it can be + # either a hard-float ABI (gcc older than 11, or gcc11 -mfloat-abi=hard + # (__CSKY_HARD_FLOAT_ABI__ is set) or -mfloat-abi=softfp + # (__CSKY_HARD_FLOAT_ABI__ is not set). To be compatible with older gcc, + # use __CSKY_HARD_FLOAT_FPU_SF__ identify if -mfloat-abi is supported, + # because it is added to gcc at the same time as -mfloat-abi. + if test -n "$hard_float"; then + if test -z "$hard_float_sf"; then + with_fp_cond=1 + else + if test -n "$hard_float_abi"; then + with_fp_cond=1 + else + with_fp_cond=0 + fi + fi + else + with_fp_cond=0 + fi + + base_machine=csky + machine=csky/$machine + + AC_DEFINE_UNQUOTED([CSKYABI], [$abi]) + AC_DEFINE_UNQUOTED([CSKY_HARD_FLOAT], [$with_fp_cond]) + ;; +esac From patchwork Thu May 12 22:28:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 53880 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 96549385736C for ; Thu, 12 May 2022 22:29:33 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.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 76149384B82F for ; Thu, 12 May 2022 22:28:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76149384B82F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x429.google.com with SMTP id h16so8410017wrb.2 for ; Thu, 12 May 2022 15:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=vUlareFvKclEFsMiXJ+PAHLijGEl3D4dTZav8kkFHnE=; b=ckUr450AjLxeoCMcbi6Jw5AeMcaklfbda3ksot3vsMDTs95gyJDysRydi2bs0Yex4C +/AnwIiDQIEW4wc+PmkzEoiOmkA/S+QdYhsGZeRmZFbU/8Zsr0wWVmxTP5UziRZTdhWO 8Gw0fXid+d+6FfuA8eAm4A4oPKLsVCoh+TVIoGawCsNQCxGhFJvcEowKao37zp92GWhm Pm+dPwgElrLONSd6+napZkbb/3/9/6N8ABoAGUDxYMppTl35fydMBlJjdZMBhQhGPuH9 Rtd2nFGMm4I7lVyngxkPhZKRntb2smQmH7xnzdXdnqVqpXRUymPkJG+XWd5ypdshMr+o TVnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=vUlareFvKclEFsMiXJ+PAHLijGEl3D4dTZav8kkFHnE=; b=HR5MbrdtoKTcC4q4eevitORe98dPqmnAm+z2NZmf1++xlutOORu3J8out2Nh8x7Dvs O8sZdB5nNn52Oft15Pl4yOjJbPm9syU8UlwQJ3qZoaBfd9Cyb0bDmFBZdgKxwL6nDq1Z WmZ2V9A4a9pkxnRbFjvzHSyiDdUFPtqSt9BYmK99TSlk5Heu7jYlxL16LToC0TDr9oYy yQpnpDZpsgupycGTFWuyhftBIyMjUX/PtIqVsTuUh45U5xjKPUbuzRtT53m6eAJRvJMo Lor9IFk90Gn6NzGDGBcmXUCwsBa98HX95J/vaT6+Npm0gmvFARfFQHOlp3SIc31nkASD 60ww== X-Gm-Message-State: AOAM531iu15moen0AHMkktLUtSGT/XpA9ffkBMwmgy2VFqS5VBkwHoPH KBpJMAYCiHdNejgidBcCqbsrtfsB/oi0/0jW X-Google-Smtp-Source: ABdhPJy1anm4/QoS4clgckTCe4076yIs53hP1AURFfiQrUM3VAJ9sMwIoP202BLFhXqsqATO41M0tA== X-Received: by 2002:a5d:4e92:0:b0:20a:cafc:ebf1 with SMTP id e18-20020a5d4e92000000b0020acafcebf1mr1386349wru.17.1652394536383; Thu, 12 May 2022 15:28:56 -0700 (PDT) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id s16-20020adfa290000000b0020c5253d91asm561454wra.102.2022.05.12.15.28.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 15:28:55 -0700 (PDT) Date: Thu, 12 May 2022 23:28:54 +0100 (BST) From: "Maciej W. Rozycki" To: libc-alpha@sourceware.org Subject: [PATCH v2 2/4] m68k: Use an autoconf template to produce `preconfigure' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Waterman , Mao Han , Andreas Schwab , Joseph Myers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Switch to using AC_MSG_ERROR rather than `echo' and `exit' directly for error handling. Owing to the lack of any kind of error annotation it makes it difficult to spot the message in the flood in a parallel build and neither it is logged in `config.log'. --- New change in v2. --- sysdeps/m68k/preconfigure | 6 ++++-- sysdeps/m68k/preconfigure.ac | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) glibc-m68k-preconfigure-as-fn-error.diff Index: glibc/sysdeps/m68k/preconfigure =================================================================== --- glibc.orig/sysdeps/m68k/preconfigure +++ glibc/sysdeps/m68k/preconfigure @@ -1,3 +1,6 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! +# Local preconfigure fragment for sysdeps/m68k + # This fragment canonicalizes the machine names for m68k variants. case "$machine" in @@ -10,8 +13,7 @@ m68k) variant=`(echo "#ifdef __mcoldfir $CC $CFLAGS $CPPFLAGS -E - | grep '^[a-z]'` if test -z "$variant"; then - echo >&2 "Cannot determine m68k processor variant" - exit 1 + as_fn_error 1 "Cannot determine m68k processor variant" "$LINENO" 5 fi base_machine=m68k machine=m68k/$variant if test "$variant" = "coldfire"; then Index: glibc/sysdeps/m68k/preconfigure.ac =================================================================== --- /dev/null +++ glibc/sysdeps/m68k/preconfigure.ac @@ -0,0 +1,23 @@ +GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/m68k + +# This fragment canonicalizes the machine names for m68k variants. + +case "$machine" in +m680?0) base_machine=m68k machine=m68k/m680x0/$machine ;; +m68k) variant=`(echo "#ifdef __mcoldfire__" + echo "coldfire" + echo "#else" + echo "m680x0/m68020" + echo "#endif") | + $CC $CFLAGS $CPPFLAGS -E - | + grep '^[[a-z]]'` + if test -z "$variant"; then + AC_MSG_ERROR([Cannot determine m68k processor variant], [1]) + fi + base_machine=m68k machine=m68k/$variant + if test "$variant" = "coldfire"; then + with_fp_cond="defined __mcffpu__" + fi + ;; +esac From patchwork Thu May 12 22:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 53881 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 7A295384B000 for ; Thu, 12 May 2022 22:29:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 74F74385040D for ; Thu, 12 May 2022 22:29:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74F74385040D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42d.google.com with SMTP id u3so9128517wrg.3 for ; Thu, 12 May 2022 15:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=wz8xWpezP1eQZ0ycBkHtt8zYz71euYjMi7qbXI9rhfI=; b=FkWMRzedzu2QhNhqr1uWatX83T6nTt7aRaw1rWIgVUH6N7nhOBIGDEynlvEwJDCFIk gP50flBorC2tuIepNVKeXGADjxBoUX1DLQMsVljx5Bpka/dRQcdApjeRLwzl5ZKRYRzE d5eBiezz6xsN789JjzdDeHk4AP2MiAPFQmyDJZgYefnMD6h6LooISwmDng+NYGxA3U8E od8TUadmNRAIuGoUeUOH1I81XfxbwtG2B/cyT/Z559DOijg8ucJWKebAlT5Hf2pUHzOh JocjNm+EdbBotamNKlESVfEfpyv7Vj3VtNUPn1A22AMJYAgmW1mmjCS9Nkyw6GVPU0SO A3Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=wz8xWpezP1eQZ0ycBkHtt8zYz71euYjMi7qbXI9rhfI=; b=2HRUuOueZOcjqRZtAnVEtPAtwIBiQBRl1Il9NPNHOl8URYAfbMCf0ySc5jv/ZpOzZk IZQcWwfTWGn9IbzuEONT/kuS6KLI0gWM3g11AeFOhZcuz79DvXXwF1vdyegWqu+Rig5K fb7hJKZP95WhanQLFiWp5TKZ5+fNbRaZi1O9mji7s2d5SYOR/fbXpnlmegGxszqnhVWi XOk9Il9WvfU51lQeEOdhEHjfi9SZwnfFHrcutjEj/flL6VONW3Q4evmF4K1I7aF5mZuD K6eLm/W8/zZqPzlHZyweHH3GK7yZrPm+oYFTc1wPHd0tRxEgJ8vMHG1ztuyylEZkaNi5 7IHQ== X-Gm-Message-State: AOAM5310306yQZYBSpvpyseqeVejWwVcjpRcBgZKEA0FEROxAuFb4HAK zG2Gw6qD+E2erdPut8+FRBs6OPT6O7wtuf/E X-Google-Smtp-Source: ABdhPJzn8sTCgCjdMqfk2lXO/zmpGU3dn5bQkLkwwdhkaxZ1Jn/9B4TQ4HK09CAGQu6OrxxJYwSLbw== X-Received: by 2002:a5d:5544:0:b0:20a:819d:5249 with SMTP id g4-20020a5d5544000000b0020a819d5249mr1435133wrw.461.1652394545298; Thu, 12 May 2022 15:29:05 -0700 (PDT) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id j15-20020adfa54f000000b0020c5253d908sm551415wrb.84.2022.05.12.15.29.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 15:29:04 -0700 (PDT) Date: Thu, 12 May 2022 23:29:03 +0100 (BST) From: "Maciej W. Rozycki" To: libc-alpha@sourceware.org Subject: [PATCH v2 3/4] MIPS: Use an autoconf template to produce `preconfigure' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Waterman , Mao Han , Andreas Schwab , Joseph Myers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Avoid fiddling with autoconf internals and use AC_DEFINE_UNQUOTED to define macros in the configuration headers rather than handcoding an equivalent shell sequence with the use of the `as_echo' undocumented variable. Similarly use AC_MSG_ERROR for error handling rather than the internal undocumented `as_fn_error' variable. Switch to using 1 as the exit code as it makes no sense to refer $? in the contexts involved, it's not a command failure handled there. --- New change in v2. --- sysdeps/mips/preconfigure | 7 +++++-- sysdeps/mips/preconfigure.ac | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) glibc-mips-preconfigure-as-fn-error.diff Index: glibc/sysdeps/mips/preconfigure =================================================================== --- glibc.orig/sysdeps/mips/preconfigure +++ glibc/sysdeps/mips/preconfigure @@ -1,3 +1,6 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! +# Local preconfigure fragment for sysdeps/mips + case "$machine" in mips*) abiflag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define _MIPS_SIM \(.*\)/\1/p'` @@ -15,7 +18,7 @@ mips*) elif test "$abiflag" = "_ABI64" ; then machine=mips/mips64/n64 else - as_fn_error $? "Unable to determine ABI." "$LINENO" 5 + as_fn_error 1 "Unable to determine ABI." "$LINENO" 5 fi # $config_machine is not really needed here but the slash after # $machine is needed by the case statement in @@ -23,7 +26,7 @@ mips*) machine=$machine/$config_machine if test "$abiflag" != "_ABIO32" -a "$mips16flag" = "1"; then - as_fn_error $? "MIPS16 is only supported with the o32 ABI." "$LINENO" 5 + as_fn_error 1 "MIPS16 is only supported with the o32 ABI." "$LINENO" 5 fi with_fp_cond="defined __mips_hard_float" Index: glibc/sysdeps/mips/preconfigure.ac =================================================================== --- /dev/null +++ glibc/sysdeps/mips/preconfigure.ac @@ -0,0 +1,34 @@ +GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/mips + +case "$machine" in +mips*) + abiflag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define _MIPS_SIM \(.*\)/\1/p'` + mips16flag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __mips16 \(.*\)/\1/p'` + + base_machine=mips + if test "$abiflag" = "_ABIO32" ; then + if test "$mips16flag" = "1" ; then + machine=mips/mips32/mips16 + else + machine=mips/mips32 + fi + elif test "$abiflag" = "_ABIN32" ; then + machine=mips/mips64/n32 + elif test "$abiflag" = "_ABI64" ; then + machine=mips/mips64/n64 + else + AC_MSG_ERROR([Unable to determine ABI.], [1]) + fi + # $config_machine is not really needed here but the slash after + # $machine is needed by the case statement in + # sysdeps/unix/sysv/linux/mips/configure.ac. + machine=$machine/$config_machine + + if test "$abiflag" != "_ABIO32" -a "$mips16flag" = "1"; then + AC_MSG_ERROR([MIPS16 is only supported with the o32 ABI.], [1]) + fi + + with_fp_cond="defined __mips_hard_float" + ;; +esac From patchwork Thu May 12 22:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 53882 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 F347B3850438 for ; Thu, 12 May 2022 22:30:21 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.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 3FDAB3846409 for ; Thu, 12 May 2022 22:29:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FDAB3846409 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x429.google.com with SMTP id w4so9062364wrg.12 for ; Thu, 12 May 2022 15:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=VFIYXFg2Xt8QSBItVEocElyNjT2bHRKRtfY8U8eaG+E=; b=WOLCoUcBo1CRjD+PW3WbJVyxvijlqJtQdhJ+6qdf+ey+V+K9x+gQh7Z4nQF9nJq8Bm 1mdYG8e0Ee0C9B0zgNg2+1YtHaDxe9LAdvyC7yJYj46uQtj4kBEqnW4Ss2/GIwojnuI7 az2S1jt4rMkKYmOagYFh4Rb54shHU+B0fA46yESEIUm7GJXiLCUiRw3iE8jWwvjnRvSQ 2TU8Ks9HJpH4KgqBI2rZ/CiHus+1nnI1t4WAJo9a8elrLQLKXm5dJTD6NQm84j5j6S8M n0dawWoOltvVjRl1jscFGdOVRVpcFJVO+QRhVk6oHpEPMTqa687M0bth6JQy+uVzbO1T VoXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=VFIYXFg2Xt8QSBItVEocElyNjT2bHRKRtfY8U8eaG+E=; b=uoOGFKqjzx/VMrD08QjK+/uolO4sMBpTilIOwLKret3QAdXLErhycNP4ZJqHr/md8M Oisc5d9F+4/OqH44blgdXjz9c5qkxc03wHkKYlhPu+emc1lqIIS11e9+8VqByea60qyC tQVh4unnkRZAd2M204qrlMSNuBI1n8J7AO1ziS/YYPaAS9CKr1W73N1LI0nRfx1St4/I vxWpbv+dUqAR2O2pIwbjKYt8+wecf4z7mr3PFnm4UT/z9aUukBy5A79GAuHfCQtwNRh7 M6sYIvsCyGQj2NWqMio/s3z5EYeV7Vma0P+NMoy0W3Ry7va/Fsev+ze/DELvHrcsXgux KeNg== X-Gm-Message-State: AOAM530yqyXXLadh9EK/PyigBSWkS2zY02ikiRHOvK4Ld1DibhSqtT4j ERxxvLVnNZRbJsD2gumtuBGJJARGOMTrdVjA X-Google-Smtp-Source: ABdhPJx5ujS0dAvrAQ905P0hv02Mdd7ZO0aUdUF5lyY/XtZC5AZaqGYmZEijGi7xZDVkarpKzUbrgA== X-Received: by 2002:a5d:510b:0:b0:20a:cb62:d9fe with SMTP id s11-20020a5d510b000000b0020acb62d9femr1519937wrt.108.1652394553066; Thu, 12 May 2022 15:29:13 -0700 (PDT) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id h18-20020a1ccc12000000b003943558a976sm663152wmb.29.2022.05.12.15.29.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 15:29:12 -0700 (PDT) Date: Thu, 12 May 2022 23:29:11 +0100 (BST) From: "Maciej W. Rozycki" To: libc-alpha@sourceware.org Subject: [PATCH v2 4/4] RISC-V: Use an autoconf template to produce `preconfigure' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Waterman , Mao Han , Andreas Schwab , Joseph Myers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Avoid fiddling with autoconf internals and use AC_DEFINE_UNQUOTED to define macros in the configuration headers rather than handcoding an equivalent shell sequence with the use of the `as_echo' undocumented variable. Switch to using AC_MSG_ERROR rather than `echo' and `exit' directly for error handling. Owing to the lack of any kind of error annotation it makes it difficult to spot the message in the flood in a parallel build and neither it is logged in `config.log'. Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt --- Changes from v1: - Convert the script to an autoconf template and use AC_MSG_ERROR. - Also handle configuration macro definitions, using AC_DEFINE_UNQUOTED. --- sysdeps/riscv/preconfigure | 33 +++++++++++---------- sysdeps/riscv/preconfigure.ac | 64 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 15 deletions(-) glibc-riscv-preconfigure-as-fn-error.diff Index: glibc/sysdeps/riscv/preconfigure =================================================================== --- glibc.orig/sysdeps/riscv/preconfigure +++ glibc/sysdeps/riscv/preconfigure @@ -1,3 +1,6 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! +# Local preconfigure fragment for sysdeps/riscv + case "$machine" in riscv*) xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'` @@ -9,8 +12,7 @@ riscv*) 64 | 32) ;; *) - echo "Unable to determine XLEN" >&2 - exit 1 + as_fn_error 1 "Unable to determine XLEN" "$LINENO" 5 ;; esac @@ -20,15 +22,13 @@ riscv*) with_fp_cond=1 ;; 32) - echo "glibc does not yet support systems with the F but not D extensions" >&2 - exit 1 + as_fn_error 1 "glibc does not yet support systems with the F but not D extensions" "$LINENO" 5 ;; "") with_fp_cond=0 ;; *) - echo "Unable to determine FLEN" >&2 - exit 1 + as_fn_error 1 "Unable to determine FLEN" "$LINENO" 5 ;; esac @@ -37,31 +37,34 @@ riscv*) abi_flen=0 ;; single) - echo "glibc does not yet support the single floating-point ABI" >&2 - exit 1 + as_fn_error 1 "glibc does not yet support the single floating-point ABI" "$LINENO" 5 ;; double) abi_flen=64 ;; *) - echo "Unable to determine floating-point ABI" >&2 - exit 1 + as_fn_error 1 "Unable to determine floating-point ABI" "$LINENO" 5 ;; esac case "$atomic" in __riscv_atomic) - ;; + ;; *) - echo "glibc requires the A extension" >&2 - exit 1 + as_fn_error 1 "glibc requires the A extension" "$LINENO" 5 ;; esac base_machine=riscv machine=riscv/rv$xlen/$float_machine - $as_echo "#define RISCV_ABI_XLEN $xlen" >>confdefs.h - $as_echo "#define RISCV_ABI_FLEN $abi_flen" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define RISCV_ABI_XLEN $xlen +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define RISCV_ABI_FLEN $abi_flen +_ACEOF + ;; esac Index: glibc/sysdeps/riscv/preconfigure.ac =================================================================== --- /dev/null +++ glibc/sysdeps/riscv/preconfigure.ac @@ -0,0 +1,64 @@ +GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/riscv + +case "$machine" in +riscv*) + xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'` + flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'` + float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'` + atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2` + + case "$xlen" in + 64 | 32) + ;; + *) + AC_MSG_ERROR([Unable to determine XLEN], [1]) + ;; + esac + + case "$flen" in + 64) + float_machine=rvd + with_fp_cond=1 + ;; + 32) + AC_MSG_ERROR([glibc does not yet support systems with the F but not D extensions], 1) + ;; + "") + with_fp_cond=0 + ;; + *) + AC_MSG_ERROR([Unable to determine FLEN], [1]) + ;; + esac + + case "$float_abi" in + soft) + abi_flen=0 + ;; + single) + AC_MSG_ERROR([glibc does not yet support the single floating-point ABI], [1]) + ;; + double) + abi_flen=64 + ;; + *) + AC_MSG_ERROR([Unable to determine floating-point ABI], [1]) + ;; + esac + + case "$atomic" in + __riscv_atomic) + ;; + *) + AC_MSG_ERROR([glibc requires the A extension], [1]) + ;; + esac + + base_machine=riscv + machine=riscv/rv$xlen/$float_machine + + AC_DEFINE_UNQUOTED([RISCV_ABI_XLEN], [$xlen]) + AC_DEFINE_UNQUOTED([RISCV_ABI_FLEN], [$abi_flen]) + ;; +esac