From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 3F04D3858D28 for ; Wed, 6 Sep 2023 06:43:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F04D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C996D106F; Tue, 5 Sep 2023 23:44:06 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F3F743F64C; Tue, 5 Sep 2023 23:43:27 -0700 (PDT) From: Richard Sandiford To: Yang Yujie Mail-Followup-To: Yang Yujie ,gcc-patches@gcc.gnu.org, xry111@xry111.site, xuchenghua@loongson.cn, panchenghui@loongson.cn, chenglulu@loongson.cn, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, xry111@xry111.site, xuchenghua@loongson.cn, panchenghui@loongson.cn, chenglulu@loongson.cn Subject: Re: [PATCH v1 2/6] LoongArch: improved target configuration interface References: <20230814035707.11272-1-yangyujie@loongson.cn> <20230814035707.11272-2-yangyujie@loongson.cn> Date: Wed, 06 Sep 2023 07:43:26 +0100 In-Reply-To: <20230814035707.11272-2-yangyujie@loongson.cn> (Yang Yujie's message of "Mon, 14 Aug 2023 11:57:03 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-19.2 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Yang Yujie writes: > @@ -5171,25 +5213,21 @@ case "${target}" in > # ${with_multilib_list} should not contain whitespaces, > # consecutive commas or slashes. > if echo "${with_multilib_list}" \ > - | grep -E -e "[[:space:]]" -e '[,/][,/]' -e '[,/]$' -e '^[,/]' > /dev/null; then > + | grep -E -e "[[:space:]]" -e '[,/][,/]' -e '[,/]$' -e '^[,/]' > /dev/null 2>&1; then > echo "Invalid argument to --with-multilib-list." 1>&2 > exit 1 > fi > > - unset component idx elem_abi_base elem_abi_ext elem_tmp > + unset component elem_abi_base elem_abi_ext elem_tmp parse_state all_abis > for elem in $(echo "${with_multilib_list}" | tr ',' ' '); do > - idx=0 > - while true; do > - idx=$((idx + 1)) > - component=$(echo "${elem}" | awk -F'/' '{print $'"${idx}"'}') > - > - case ${idx} in > - 1) > - # Component 1: Base ABI type > + unset elem_abi_base elem_abi_ext > + parse_state="abi-base" > + > + for component in $(echo "${elem}" | tr '/' ' '); do > + if test x${parse_state} = x"abi-base"; then > + # Base ABI type > case ${component} in > - lp64d) elem_tmp="ABI_BASE_LP64D,";; > - lp64f) elem_tmp="ABI_BASE_LP64F,";; > - lp64s) elem_tmp="ABI_BASE_LP64S,";; > + lp64d | lp64f | lp64s) elem_tmp="ABI_BASE_$(tr a-z A-Z <<< ${component}),";; "<<<" isn't portable shell. Could you try with: echo ${component} | tr ... instead? As it stands, this causes a bootstrap failure with non-bash shells such as dash, even on non-Loongson targets. (Part of me wishes that we'd just standardise on bash. But since that isn't the policy, I sometimes use dash to pick up my own lapses.) Thanks, Richard