All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: change endian cross compilation test
@ 2012-03-14 16:36 Stuart Yoder
  2012-03-14 16:54 ` Paul Brook
  0 siblings, 1 reply; 5+ messages in thread
From: Stuart Yoder @ 2012-03-14 16:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, paul, Stuart Yoder

From: Stuart Yoder <stuart.yoder@freescale.com>

Previous check in configure's endian test was to determine if
this is a cross-compile build by testing whether --cross-prefix
was used.  This does not work for cross build environments
like Yocto that may set CC instead of --cross-prefix.

Instead, test whether host compiler is same as target compiler,
which also works when --cross-prefix is used.

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index fe4fc4f..c5333bf 100755
--- a/configure
+++ b/configure
@@ -1269,7 +1269,7 @@ feature_not_found() {
   exit 1;
 }
 
-if test -z "$cross_prefix" ; then
+if test $cc = $host_cc; then
 
 # ---
 # big/little endian test
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: change endian cross compilation test
  2012-03-14 16:36 [Qemu-devel] [PATCH] configure: change endian cross compilation test Stuart Yoder
@ 2012-03-14 16:54 ` Paul Brook
  2012-03-14 17:17   ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Brook @ 2012-03-14 16:54 UTC (permalink / raw)
  To: Stuart Yoder; +Cc: aliguori, qemu-devel

> From: Stuart Yoder <stuart.yoder@freescale.com>
> 
> Previous check in configure's endian test was to determine if
> this is a cross-compile build by testing whether --cross-prefix
> was used.  This does not work for cross build environments
> like Yocto that may set CC instead of --cross-prefix.
> 
> Instead, test whether host compiler is same as target compiler,
> which also works when --cross-prefix is used.

I'd much rather remove this test altogether.  If the cross case doesn't give 
the right answer for all the host systems we care about then we should fix 
that.

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: change endian cross compilation test
  2012-03-14 16:54 ` Paul Brook
@ 2012-03-14 17:17   ` Peter Maydell
       [not found]     ` <CALRxmdAhwT-2p2VaO2mpN7sLr46BTBZRBkXsWWpoCd=UBH5PNQ@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2012-03-14 17:17 UTC (permalink / raw)
  To: Paul Brook; +Cc: aliguori, Stuart Yoder, qemu-devel

2012/3/14 Paul Brook <paul@codesourcery.com>:
>> From: Stuart Yoder <stuart.yoder@freescale.com>
>>
>> Previous check in configure's endian test was to determine if
>> this is a cross-compile build by testing whether --cross-prefix
>> was used.  This does not work for cross build environments
>> like Yocto that may set CC instead of --cross-prefix.

Do we even support not using --cross-prefix ? I'd have expected just
setting CC to run into random problems like using the host arch's
version of strip rather than the cross toolchain, the host's
pkg-config rather than the one that knows where the cross libraries
are, etc etc.

>> Instead, test whether host compiler is same as target compiler,
>> which also works when --cross-prefix is used.
>
> I'd much rather remove this test altogether.  If the cross case doesn't give
> the right answer for all the host systems we care about then we should fix
> that.

Agreed. I think looking at the host CPUs we support the only ones
that aren't guaranteed either big or little endian are (a) mips
and (b) ARM. ARM already identifies big-endian by a compile-time
check, and it seems likely that MIPS could too.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: change endian cross compilation test
       [not found]     ` <CALRxmdAhwT-2p2VaO2mpN7sLr46BTBZRBkXsWWpoCd=UBH5PNQ@mail.gmail.com>
@ 2012-03-14 18:09       ` Peter Maydell
  2012-03-14 19:00         ` Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2012-03-14 18:09 UTC (permalink / raw)
  To: Stuart Yoder; +Cc: QEMU Developers

[added qemu-devel back again]

On 14 March 2012 17:51, Stuart Yoder <b08248@gmail.com> wrote:
> On Wed, Mar 14, 2012 at 12:17 PM, Peter Maydell
> <peter.maydell@linaro.org> wrote:
>> Agreed. I think looking at the host CPUs we support the only ones
>> that aren't guaranteed either big or little endian are (a) mips
>> and (b) ARM. ARM already identifies big-endian by a compile-time
>> check, and it seems likely that MIPS could too.
>
> So, you're proposing just leaving the test as:
>
> # if cross compiling, cannot launch a program, so make a static guess
> case "$cpu" in
>  arm)
>    # ARM can be either way; ask the compiler which one we are
>    if check_define __ARMEB__; then
>      bigendian=yes
>    fi
>  ;;
>  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
>    bigendian=yes
>  ;;
> esac

No, I'm proposing that you find out what the right check_define
for mips is and make mips|mips64 have a similar case to the arm
one. Google suggests the answer is __MIPSEB__; you can do a quick
check by firing up the mipsel/mips images from
http://people.debian.org/~aurel32/qemu/ under qemu :-)

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: change endian cross compilation test
  2012-03-14 18:09       ` Peter Maydell
@ 2012-03-14 19:00         ` Stefan Weil
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2012-03-14 19:00 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Stuart Yoder

Am 14.03.2012 19:09, schrieb Peter Maydell:
> [added qemu-devel back again]
>
> On 14 March 2012 17:51, Stuart Yoder<b08248@gmail.com>  wrote:
>> On Wed, Mar 14, 2012 at 12:17 PM, Peter Maydell
>> <peter.maydell@linaro.org>  wrote:
>>> Agreed. I think looking at the host CPUs we support the only ones
>>> that aren't guaranteed either big or little endian are (a) mips
>>> and (b) ARM. ARM already identifies big-endian by a compile-time
>>> check, and it seems likely that MIPS could too.
>> So, you're proposing just leaving the test as:
>>
>> # if cross compiling, cannot launch a program, so make a static guess
>> case "$cpu" in
>>   arm)
>>     # ARM can be either way; ask the compiler which one we are
>>     if check_define __ARMEB__; then
>>       bigendian=yes
>>     fi
>>   ;;
>>   hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
>>     bigendian=yes
>>   ;;
>> esac
> No, I'm proposing that you find out what the right check_define
> for mips is and make mips|mips64 have a similar case to the arm
> one. Google suggests the answer is __MIPSEB__; you can do a quick
> check by firing up the mipsel/mips images from
> http://people.debian.org/~aurel32/qemu/ under qemu :-)
>
> -- PMM

Running

     git grep "__MIPSEB__"

or

     git grep "__MIPSEL__"

would be a quicker check :-))

Stefan W.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-14 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 16:36 [Qemu-devel] [PATCH] configure: change endian cross compilation test Stuart Yoder
2012-03-14 16:54 ` Paul Brook
2012-03-14 17:17   ` Peter Maydell
     [not found]     ` <CALRxmdAhwT-2p2VaO2mpN7sLr46BTBZRBkXsWWpoCd=UBH5PNQ@mail.gmail.com>
2012-03-14 18:09       ` Peter Maydell
2012-03-14 19:00         ` Stefan Weil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.