diff mbox series

[v1,01/11] configure: don't override the selected host test compiler if defined

Message ID 20210917162332.3511179-2-alex.bennee@linaro.org
State New
Headers show
Series testing and plugin pre-PR (configure, gitlab, plugins) | expand

Commit Message

Alex Bennée Sept. 17, 2021, 4:23 p.m. UTC
There are not many cases you would want to do this but one is if you
want to use a test friendly compiler like gcc instead of a system
compiler like clang. Either way we should honour the users choice if
they have made it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Cc: Warner Losh <imp@bsdimp.com>
---
 configure | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.30.2

Comments

Warner Losh Sept. 17, 2021, 5:04 p.m. UTC | #1
On Fri, Sep 17, 2021 at 10:23 AM Alex Bennée <alex.bennee@linaro.org> wrote:

> There are not many cases you would want to do this but one is if you

> want to use a test friendly compiler like gcc instead of a system

> compiler like clang. Either way we should honour the users choice if

> they have made it.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Cc: Warner Losh <imp@bsdimp.com>

> ---

>  configure | 7 +++++--

>  1 file changed, 5 insertions(+), 2 deletions(-)

>


Reviewed-by: Warner Losh <imp@bsdimp.com>



> diff --git a/configure b/configure

> index 1043ccce4f..049c50a933 100755

> --- a/configure

> +++ b/configure

> @@ -1686,8 +1686,11 @@ case "$cpu" in

>      # No special flags required for other host CPUs

>  esac

>

> -eval "cross_cc_${cpu}=\$cc"

> -cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"

> +if eval test -z "\${cross_cc_$cpu}"; then

> +    eval "cross_cc_${cpu}=\$cc"

> +    cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"

> +fi

> +

>  QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"

>

>  # For user-mode emulation the host arch has to be one we explicitly

> --

> 2.30.2

>

>
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 17, 2021 at 10:23 AM Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org">alex.bennee@linaro.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There are not many cases you would want to do this but one is if you<br>
want to use a test friendly compiler like gcc instead of a system<br>
compiler like clang. Either way we should honour the users choice if<br>
they have made it.<br>
<br>
Signed-off-by: Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org" target="_blank">alex.bennee@linaro.org</a>&gt;<br>

Cc: Warner Losh &lt;<a href="mailto:imp@bsdimp.com" target="_blank">imp@bsdimp.com</a>&gt;<br>
---<br>
 configure | 7 +++++--<br>
 1 file changed, 5 insertions(+), 2 deletions(-)<br></blockquote><div><br></div><div>Reviewed-by: Warner Losh &lt;<a href="mailto:imp@bsdimp.com">imp@bsdimp.com</a>&gt;</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
diff --git a/configure b/configure<br>
index 1043ccce4f..049c50a933 100755<br>
--- a/configure<br>
+++ b/configure<br>
@@ -1686,8 +1686,11 @@ case &quot;$cpu&quot; in<br>
     # No special flags required for other host CPUs<br>
 esac<br>
<br>
-eval &quot;cross_cc_${cpu}=\$cc&quot;<br>
-cross_cc_vars=&quot;$cross_cc_vars cross_cc_${cpu}&quot;<br>
+if eval test -z &quot;\${cross_cc_$cpu}&quot;; then<br>
+    eval &quot;cross_cc_${cpu}=\$cc&quot;<br>
+    cross_cc_vars=&quot;$cross_cc_vars cross_cc_${cpu}&quot;<br>
+fi<br>
+<br>
 QEMU_CFLAGS=&quot;$CPU_CFLAGS $QEMU_CFLAGS&quot;<br>
<br>
 # For user-mode emulation the host arch has to be one we explicitly<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>
Ed Maste Sept. 20, 2021, 2:46 p.m. UTC | #2
On Fri, 17 Sept 2021 at 12:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>

> There are not many cases you would want to do this but one is if you

> want to use a test friendly compiler like gcc instead of a system

> compiler like clang. Either way we should honour the users choice if

> they have made it.


A little bit of a tangent, but I'm curious about this comment - what
aspects of GCC make it more test friendly? (I help maintain LLVM tools
on FreeBSD, and would like to make sure they provide as good an
experience as possible.)
Alex Bennée Sept. 20, 2021, 4:37 p.m. UTC | #3
Ed Maste <emaste@freebsd.org> writes:

> On Fri, 17 Sept 2021 at 12:27, Alex Bennée <alex.bennee@linaro.org> wrote:

>>

>> There are not many cases you would want to do this but one is if you

>> want to use a test friendly compiler like gcc instead of a system

>> compiler like clang. Either way we should honour the users choice if

>> they have made it.

>

> A little bit of a tangent, but I'm curious about this comment - what

> aspects of GCC make it more test friendly? (I help maintain LLVM tools

> on FreeBSD, and would like to make sure they provide as good an

> experience as possible.)


Some of the inline assembler in the old tests trips up LLVM. There is a
chance the inline assembly is a bit bogus with it's constraints and GCC
is just a bit more lax and accepting.

I'm totally fine with merging something that restores support for clang
for building tests it just needs the appropriate fixups to the tests. We
already use clang for the hexagon builds after all. Once that is done we
can drop the stuff in cf22f936f2 (tests/tcg: don't allow clang as a
cross compiler).

-- 
Alex Bennée
diff mbox series

Patch

diff --git a/configure b/configure
index 1043ccce4f..049c50a933 100755
--- a/configure
+++ b/configure
@@ -1686,8 +1686,11 @@  case "$cpu" in
     # No special flags required for other host CPUs
 esac
 
-eval "cross_cc_${cpu}=\$cc"
-cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
+if eval test -z "\${cross_cc_$cpu}"; then
+    eval "cross_cc_${cpu}=\$cc"
+    cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
+fi
+
 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
 
 # For user-mode emulation the host arch has to be one we explicitly