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 988723858D1E for ; Tue, 14 Feb 2023 03:32:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 988723858D1E 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 _____8BxNNixAOtjpFoAAA--.32S3; Tue, 14 Feb 2023 11:32:01 +0800 (CST) Received: from [10.20.4.52] (unknown [10.20.4.52]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxyuawAOtj8aEyAA--.60283S2; Tue, 14 Feb 2023 11:32:01 +0800 (CST) Subject: Re: [PATCH] LoongArch: Fix multiarch tuple canonization To: Xi Ruoyao , gcc-patches@gcc.gnu.org Cc: WANG Xuerui , Chenghua Xu , "yangyujie@loongson.cn" References: <20230213103853.502212-1-xry111@xry111.site> From: Lulu Cheng Message-ID: <6b00fcca-6b8a-43a3-cc30-069f1d945408@loongson.cn> Date: Tue, 14 Feb 2023 11:32:00 +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: <20230213103853.502212-1-xry111@xry111.site> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8BxyuawAOtj8aEyAA--.60283S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxZrWfuF47KryxCrW5Gw1DGFg_yoW5KFWDpF 9xua4rKF4kZrZYgrsrZ345Xw1DJry7Gr9xuF4xKry8u34jvry8Xas3KwnrWF1kX3ZrXrZ2 9Fy8G3WUXa1UXa7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bI8YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1cAE67vIY487Mx AIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_ Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwI xGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8 JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcV C2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUzZ2-UUUUU X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,MIME_CHARSET_FARAWAY,NICE_REPLY_A,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: add yangyujie. ÔÚ 2023/2/13 ÏÂÎç6:38, Xi Ruoyao дµÀ: > 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$\