public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: LuluCheng <chenglulu@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-9187] LoongArch: Fix multiarch tuple canonization
Date: Sat, 18 Feb 2023 08:55:46 +0000 (GMT)	[thread overview]
Message-ID: <20230218085546.2BC013858D38@sourceware.org> (raw)

https://gcc.gnu.org/g:5fa1f732537883908f071f0b0c32f0e9dc5194ff

commit r12-9187-g5fa1f732537883908f071f0b0c32f0e9dc5194ff
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Mon Feb 13 18:38:53 2023 +0800

    LoongArch: Fix multiarch tuple canonization
    
    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.
    
    [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).
    
    (cherry picked from commit 017849d9d88f021770a90f12fffec9aa2425ed27)

Diff:
---
 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 ed02caa18c0..5c378c698ff 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4981,20 +4981,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
@@ -5015,9 +5011,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.
@@ -5088,6 +5081,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 5b9796aea2b..136b27d0a8d 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$\

                 reply	other threads:[~2023-02-18  8:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230218085546.2BC013858D38@sourceware.org \
    --to=chenglulu@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).