diff mbox series

PR target/98152: Checking python is available before using

Message ID 20201206061250.114770-1-kito.cheng@sifive.com
State New
Headers show
Series PR target/98152: Checking python is available before using | expand

Commit Message

Kito Cheng Dec. 6, 2020, 6:12 a.m. UTC
We'll try to canonicalize the arch string for --with-arch,
and the script is written in python, however it will turns out
GCC require python to build for RISC-V port, it's not expect as
the GCC requirement.

So this patch is made this as optional, detect python and only use it
when it available, it won't break any functionality with out doing
canonicalization, just might build one more redundant multi-lib.

gcc/ChangeLog:

	* config.gcc (riscv*-*-*): Checking python, python3 or python2
	is available, and skip doing with_arch canonicalize if no python
	available.
---
 gcc/config.gcc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jim Wilson Dec. 7, 2020, 9:28 p.m. UTC | #1
On Sat, Dec 5, 2020 at 10:12 PM Kito Cheng <kito.cheng@sifive.com> wrote:

> gcc/ChangeLog:
>
>         * config.gcc (riscv*-*-*): Checking python, python3 or python2
>         is available, and skip doing with_arch canonicalize if no python
>         available.
>

Looks good to me.

Jim
Kito Cheng Dec. 8, 2020, 7:53 a.m. UTC | #2
Committed

On Tue, Dec 8, 2020 at 5:33 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Sat, Dec 5, 2020 at 10:12 PM Kito Cheng <kito.cheng@sifive.com> wrote:
>
> > gcc/ChangeLog:
> >
> >         * config.gcc (riscv*-*-*): Checking python, python3 or python2
> >         is available, and skip doing with_arch canonicalize if no python
> >         available.
> >
>
> Looks good to me.
>
> Jim
Jeff Law Dec. 13, 2020, 5:32 p.m. UTC | #3
On 12/5/20 11:12 PM, Kito Cheng wrote:
> We'll try to canonicalize the arch string for --with-arch,
> and the script is written in python, however it will turns out
> GCC require python to build for RISC-V port, it's not expect as
> the GCC requirement.
>
> So this patch is made this as optional, detect python and only use it
> when it available, it won't break any functionality with out doing
> canonicalization, just might build one more redundant multi-lib.
>
> gcc/ChangeLog:
>
> 	* config.gcc (riscv*-*-*): Checking python, python3 or python2
> 	is available, and skip doing with_arch canonicalize if no python
> 	available.
OK. 
jeff
diff mbox series

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9c7604481f1..3650b46734a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4623,7 +4623,10 @@  case "${target}" in
 			exit 1
 			;;
 		esac
-		with_arch=`${srcdir}/config/riscv/arch-canonicalize ${with_arch}`
+		PYTHON=`which python || which python3 || which python2`
+		if test "x${PYTHON}" != x; then
+			with_arch=`${PYTHON} ${srcdir}/config/riscv/arch-canonicalize ${with_arch}`
+		fi
 		tm_defines="${tm_defines} TARGET_RISCV_DEFAULT_ARCH=${with_arch}"
 
 		# Make sure --with-abi is valid.  If it was not specified,