From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id D3EBD3858D38 for ; Sat, 18 Feb 2023 08:59:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3EBD3858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.4.52]) by gateway (Coremail) with SMTP id _____8Cxjdpjk_BjEyoCAA--.5129S3; Sat, 18 Feb 2023 16:59:16 +0800 (CST) Received: from [10.20.4.52] (unknown [10.20.4.52]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxTL5hk_BjuxU2AA--.33850S2; Sat, 18 Feb 2023 16:59:13 +0800 (CST) Subject: [pushed][PATCH] LoongArch: Fix multiarch tuple canonization From: Lulu Cheng To: WANG Xuerui , Xi Ruoyao , gcc-patches@gcc.gnu.org, "zhangdandan@loongson.cn" Cc: Chenghua Xu , Revy References: <20230213103853.502212-1-xry111@xry111.site> <5b2f1ce1-6acc-0388-6ca3-30b7227103d1@loongson.cn> Message-ID: <0addd5ff-e94e-1d90-8219-1e6e1969147e@loongson.cn> Date: Sat, 18 Feb 2023 16:59:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5b2f1ce1-6acc-0388-6ca3-30b7227103d1@loongson.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8BxTL5hk_BjuxU2AA--.33850S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW3Jw1xXF13GF47tFWkAFW5ZFb_yoW7Zry3pF yvya45trWrAr1ktrnrX34UXryUJr1UG3ZrXr1UtFy8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,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Pushed r13-6126 and cherry picked to r12-9187. 在 2023/2/17 上午9:41, Lulu Cheng 写道: > Hi, > > 在 2023/2/15 下午6:42, WANG Xuerui 写道: >> Hi, >> >> On 2023/2/13 18:38, Xi Ruoyao wrote: >>> Multiarch tuple will be coded in file or directory names in >>> multiarch-aware distros, so one ABI should have only one multiarch >>> tuple.  For example, "--target=loongarch64-linux-gnu --with-abi=lp64s" >>> and "--target=loongarch64-linux-gnusf" should both set multiarch tuple >>> to "loongarch64-linux-gnusf".  Before this commit, >>> "--target=loongarch64-linux-gnu --with-abi=lp64s --disable-multilib" >>> will produce wrong result (loongarch64-linux-gnu). >>> >>> A recent LoongArch psABI revision mandates "loongarch64-linux-gnu" >>> to be >>> used for -mabi=lp64d (instead of "loongarch64-linux-gnuf64") for some >>> non-technical reason [1].  Note that we cannot make >>> "loongarch64-linux-gnuf64" an alias for "loongarch64-linux-gnu" because >>> to implement such an alias, we must create thousands of symlinks in the >>> distro and doing so would be completely unpractical.  This commit also >>> aligns GCC with the revision. >>> >>> Tested by building cross compilers with --enable-multiarch and multiple >>> combinations of --target=loongarch64-linux-gnu*, >>> --with-abi=lp64{s,f,d}, >>> and --{enable,disable}-multilib; and run "xgcc --print-multiarch" then >>> manually verify the result with eyesight. >>> >>> Ok for trunk and backport to releases/gcc-12? >>> >>> [1]: https://github.com/loongson/LoongArch-Documentation/pull/80 >>> >>> gcc/ChangeLog: >>> >>>     * config.gcc (triplet_abi): Set its value based on $with_abi, >>>     instead of $target. >>>     (la_canonical_triplet): Set it after $triplet_abi is set >>>     correctly. >>>     * config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the >>>     multiarch tuple for lp64d "loongarch64-linux-gnu" (without >>>     "f64" suffix). >>> --- >>>   gcc/config.gcc               | 14 +++++++------- >>>   gcc/config/loongarch/t-linux |  2 +- >>>   2 files changed, 8 insertions(+), 8 deletions(-) >>> >>> diff --git a/gcc/config.gcc b/gcc/config.gcc >>> index 067720ac795..c070e6ecd2e 100644 >>> --- a/gcc/config.gcc >>> +++ b/gcc/config.gcc >>> @@ -4889,20 +4889,16 @@ case "${target}" in >>>           case ${target} in >>>           loongarch64-*-*-*f64) >>>               abi_pattern="lp64d" >>> -            triplet_abi="f64" >>>               ;; >>>           loongarch64-*-*-*f32) >>>               abi_pattern="lp64f" >>> -            triplet_abi="f32" >>>               ;; >>>           loongarch64-*-*-*sf) >>>               abi_pattern="lp64s" >>> -            triplet_abi="sf" >>>               ;; >>>           loongarch64-*-*-*) >>>               abi_pattern="lp64[dfs]" >>>               abi_default="lp64d" >>> -            triplet_abi="" >>>               ;; >>>           *) >>>               echo "Unsupported target ${target}." 1>&2 >>> @@ -4923,9 +4919,6 @@ case "${target}" in >>>                 ;; >>>           esac >>>   - la_canonical_triplet="loongarch64-${triplet_os}${triplet_abi}" >>> - >>> - >>>           # Perform initial sanity checks on --with-* options. >>>           case ${with_arch} in >>>           "" | loongarch64 | la464) ;; # OK, append here. >>> @@ -4996,6 +4989,13 @@ case "${target}" in >>>               ;; >>>           esac >>>   +        case ${with_abi} in >>> +          "lp64d") triplet_abi="";; >>> +          "lp64f") triplet_abi="f32";; >>> +          "lp64s") triplet_abi="sf";; >>> +        esac >>> + la_canonical_triplet="loongarch64-${triplet_os}${triplet_abi}" >>> + >>>           # Set default value for with_abiext (internal) >>>           case ${with_abiext} in >>>           "") >>> diff --git a/gcc/config/loongarch/t-linux >>> b/gcc/config/loongarch/t-linux >>> index 131c45fdced..e40da179203 100644 >>> --- a/gcc/config/loongarch/t-linux >>> +++ b/gcc/config/loongarch/t-linux >>> @@ -40,7 +40,7 @@ ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) >>>         MULTILIB_OSDIRNAMES = \ >>>         mabi.lp64d=../lib64$\ >>> -      $(call if_multiarch,:loongarch64-linux-gnuf64) >>> +      $(call if_multiarch,:loongarch64-linux-gnu) >>>         MULTILIB_OSDIRNAMES += \ >>>         mabi.lp64f=../lib64/f32$\ >> >> Thanks for the quick patch; however Revy told me offline yesterday >> that this might conflict with things Debian side once this gets >> merged. He may have more details to share. >> >> Adding him to CC -- you could keep him CC-ed on future changes that >> may impact distro packaging. > > Thank you for your feedback. > > This modification plan is determined by the operating system group. If > there is any problem, you can describe it clearly. > > If there is no problem, we will combine this patch. > > Thanks!