* [Qemu-devel] [PATCH][v2] configure: change endianness test
@ 2012-03-14 20:37 Stuart Yoder
2012-03-14 21:24 ` Stefan Weil
0 siblings, 1 reply; 5+ messages in thread
From: Stuart Yoder @ 2012-03-14 20:37 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, paul, Stuart Yoder
From: Stuart Yoder <stuart.yoder@freescale.com>
Remove the runtime check for endianness, and for platforms
that can be bit or little endian do a compile time check.
This resolves an issue encountered building QEMU
under Yocto which was not setting --cross-prefix.
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
-v2: removed the dynamic runtime test completely,
added compile time check for mips
configure | 33 ++++++++-------------------------
1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/configure b/configure
index fe4fc4f..d9c5999 100755
--- a/configure
+++ b/configure
@@ -1269,41 +1269,24 @@ feature_not_found() {
exit 1;
}
-if test -z "$cross_prefix" ; then
-
-# ---
-# big/little endian test
-cat > $TMPC << EOF
-#include <inttypes.h>
-int main(int argc, char ** argv){
- volatile uint32_t i=0x01234567;
- return (*((uint8_t*)(&i))) == 0x67;
-}
-EOF
-
-if compile_prog "" "" ; then
-$TMPE && bigendian="yes"
-else
-echo big/little test failed
-fi
-
-else
-
-# if cross compiling, cannot launch a program, so make a static guess
+##########################################
+# endianness check
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)
+ mips|mips64)
+ if check_define __MIPSEB__; then
+ bigendian=yes
+ fi
+ ;;
+ hppa|m68k|ppc|ppc64|s390|s390x|sparc|sparc64)
bigendian=yes
;;
esac
-fi
-
##########################################
# NPTL probe
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH][v2] configure: change endianness test
2012-03-14 20:37 [Qemu-devel] [PATCH][v2] configure: change endianness test Stuart Yoder
@ 2012-03-14 21:24 ` Stefan Weil
2012-03-14 21:37 ` Peter Maydell
2012-03-14 21:49 ` Paul Brook
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Weil @ 2012-03-14 21:24 UTC (permalink / raw)
To: Stuart Yoder; +Cc: aliguori, qemu-devel, paul
Am 14.03.2012 21:37, schrieb Stuart Yoder:
> From: Stuart Yoder <stuart.yoder@freescale.com>
>
> Remove the runtime check for endianness, and for platforms
> that can be bit or little endian do a compile time check.
>
> This resolves an issue encountered building QEMU
> under Yocto which was not setting --cross-prefix.
>
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> ---
>
> -v2: removed the dynamic runtime test completely,
> added compile time check for mips
>
> configure | 33 ++++++++-------------------------
> 1 files changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/configure b/configure
> index fe4fc4f..d9c5999 100755
> --- a/configure
> +++ b/configure
> @@ -1269,41 +1269,24 @@ feature_not_found() {
> exit 1;
> }
>
> -if test -z "$cross_prefix" ; then
> -
> -# ---
> -# big/little endian test
> -cat > $TMPC << EOF
> -#include <inttypes.h>
> -int main(int argc, char ** argv){
> - volatile uint32_t i=0x01234567;
> - return (*((uint8_t*)(&i))) == 0x67;
> -}
> -EOF
> -
> -if compile_prog "" "" ; then
> -$TMPE && bigendian="yes"
> -else
> -echo big/little test failed
> -fi
> -
> -else
> -
> -# if cross compiling, cannot launch a program, so make a static guess
> +##########################################
> +# endianness check
> 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)
> + mips|mips64)
> + if check_define __MIPSEB__; then
> + bigendian=yes
> + fi
> + ;;
> + hppa|m68k|ppc|ppc64|s390|s390x|sparc|sparc64)
> bigendian=yes
> ;;
> esac
>
> -fi
> -
> ##########################################
> # NPTL probe
>
The patch fixes all issues which were addressed in the discussion,
therefore
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Nevertheless the old test which was removed still might be useful
and could be re-added later in a modified form:
Contrary to Paul's argument QEMU does not only support a fixed
set of known host architectures, but also unknown hosts (via TCI).
For those, there remains a small chance that they are big endian
and that they get the wrong endianness now. TCI is still experimental,
so I don't care too much about this small deficit.
Regards,
Stefan W.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH][v2] configure: change endianness test
2012-03-14 21:24 ` Stefan Weil
@ 2012-03-14 21:37 ` Peter Maydell
2012-03-14 21:42 ` Stefan Weil
2012-03-14 21:49 ` Paul Brook
1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2012-03-14 21:37 UTC (permalink / raw)
To: Stefan Weil; +Cc: aliguori, paul, Stuart Yoder, qemu-devel
On 14 March 2012 21:24, Stefan Weil <sw@weilnetz.de> wrote:
> Contrary to Paul's argument QEMU does not only support a fixed
> set of known host architectures, but also unknown hosts (via TCI).
> For those, there remains a small chance that they are big endian
> and that they get the wrong endianness now. TCI is still experimental,
> so I don't care too much about this small deficit.
(speaking with absolutely no idea of the innards of TCI :-))
I think the correct fix for this is that TCI should be portable
code which doesn't care about the host endianness.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH][v2] configure: change endianness test
2012-03-14 21:37 ` Peter Maydell
@ 2012-03-14 21:42 ` Stefan Weil
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2012-03-14 21:42 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, aliguori, paul, Stuart Yoder
Am 14.03.2012 22:37, schrieb Peter Maydell:
> On 14 March 2012 21:24, Stefan Weil <sw@weilnetz.de> wrote:
>> Contrary to Paul's argument QEMU does not only support a fixed
>> set of known host architectures, but also unknown hosts (via TCI).
>> For those, there remains a small chance that they are big endian
>> and that they get the wrong endianness now. TCI is still experimental,
>> so I don't care too much about this small deficit.
>
> (speaking with absolutely no idea of the innards of TCI :-))
> I think the correct fix for this is that TCI should be portable
> code which doesn't care about the host endianness.
>
> -- PMM
TCI does not care, but the rest of QEMU cares.
That's why configure determines the endianness.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH][v2] configure: change endianness test
2012-03-14 21:24 ` Stefan Weil
2012-03-14 21:37 ` Peter Maydell
@ 2012-03-14 21:49 ` Paul Brook
1 sibling, 0 replies; 5+ messages in thread
From: Paul Brook @ 2012-03-14 21:49 UTC (permalink / raw)
To: Stefan Weil; +Cc: aliguori, Stuart Yoder, qemu-devel
> Contrary to Paul's argument QEMU does not only support a fixed
> set of known host architectures, but also unknown hosts (via TCI).
> For those, there remains a small chance that they are big endian
> and that they get the wrong endianness now. TCI is still experimental,
> so I don't care too much about this small deficit.
If you're compiling for a host that obscure, then there's a good chance you'll
be cross-compiling anyway. I'd be amazed if there aren't other bits of qemu
that require host-specific code.
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-14 21:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 20:37 [Qemu-devel] [PATCH][v2] configure: change endianness test Stuart Yoder
2012-03-14 21:24 ` Stefan Weil
2012-03-14 21:37 ` Peter Maydell
2012-03-14 21:42 ` Stefan Weil
2012-03-14 21:49 ` Paul Brook
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 NNTP newsgroup(s).