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