public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: chenglulu <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] LoongArch: Allow using --with-arch=native if host CPU is LoongArch
Date: Sat, 22 Jul 2023 17:11:40 +0800	[thread overview]
Message-ID: <05cd8cd3-81f1-75d8-2460-618c1c1521ce@loongson.cn> (raw)
In-Reply-To: <20230720132910.210043-1-xry111@xry111.site>


在 2023/7/20 下午9:28, Xi Ruoyao 写道:
> If the host triple and the target triple are different but the host is
> LoongArch, in some cases --with-arch=native can be useful.  For example,
> if we are bootstrapping a loongarch64-linux-musl toolchain on a
> Glibc-based system and we don't intend to use the toolchain on other
> machines, we can use
>
>      ../gcc/configure --{build,host}=loongarch64-linux-gnu \
>                       --target=loongarch64-linux-musl --with-arch=native
>
> Relax the check in config.gcc to allow such configurations.
>
> gcc/ChangeLog:
>
> 	* config.gcc [target=loongarch*-*-*, with_arch=native]: Allow
> 	building cross compiler if the host CPU is LoongArch.
> ---
>
> Tested on x86_64-linux-gnu (building a cross compiler targeting
> LoongArch --with-arch=native still rejected) and loongarch64-linux-gnu
> (building a cross compiler targeting loongarch64-linux-musl allowed).
> Ok for trunk?


Hi, Ruoyao:

  I'm sorry that some things at home are late, can this usage scenario 
be described in detail? I didn't really understand that.

>
>   gcc/config.gcc | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 1446eb2b3ca..146bca22a38 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -4939,10 +4939,13 @@ case "${target}" in
>   		case ${with_arch} in
>   		"" | loongarch64 | la464) ;; # OK, append here.
>   		native)
> -			if test x${host} != x${target}; then
> +			case ${host} in
> +			loongarch*) ;; # OK
> +			*)
>   				echo "--with-arch=native is illegal for cross-compiler." 1>&2
>   				exit 1
> -			fi
> +				;;
> +			esac
>   			;;
>   		"")
>   			echo "Please set a default value for \${with_arch}" \


      reply	other threads:[~2023-07-22  9:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 13:28 Xi Ruoyao
2023-07-22  9:11 ` chenglulu [this message]

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=05cd8cd3-81f1-75d8-2460-618c1c1521ce@loongson.cn \
    --to=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=xry111@xry111.site \
    /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).