qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: detect endian via compile test
@ 2013-07-01  3:30 Mike Frysinger
  2013-07-02 15:19 ` Richard Henderson
  2013-08-28  8:21 ` James Hogan
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Frysinger @ 2013-07-01  3:30 UTC (permalink / raw)
  To: qemu-devel

This avoids needing to execute a program and keeping an (incomplete)
list when cross-compiling.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 configure | 40 ++++++++++++++--------------------------
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/configure b/configure
index 2206a87..19d0856 100755
--- a/configure
+++ b/configure
@@ -1386,39 +1386,27 @@ feature_not_found() {
       "configure was not able to find it"
 }
 
-if test -z "$cross_prefix" ; then
-
 # ---
 # big/little endian test
 cat > $TMPC << EOF
-#include <inttypes.h>
-int main(void) {
-        volatile uint32_t i=0x01234567;
-        return (*((uint8_t*)(&i))) == 0x67;
+short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
+short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
+extern int foo(short *, short *);
+int main(int argc, char *argv[]) {
+    return foo(big_endian, little_endian);
 }
 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
-case "$cpu" in
-  arm)
-    # ARM can be either way; ask the compiler which one we are
-    if check_define __ARMEB__; then
-      bigendian=yes
+if compile_object ; then
+    if grep -q BiGeNdIaN $TMPO ; then
+        bigendian="yes"
+    elif grep -q LiTtLeEnDiAn $TMPO ; then
+        bigendian="no"
+    else
+        echo big/little test failed
     fi
-  ;;
-  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
-    bigendian=yes
-  ;;
-esac
-
+else
+    echo big/little test failed
 fi
 
 ##########################################
-- 
1.8.2.1

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-07-01  3:30 [Qemu-devel] [PATCH] configure: detect endian via compile test Mike Frysinger
@ 2013-07-02 15:19 ` Richard Henderson
  2013-08-28  8:21 ` James Hogan
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2013-07-02 15:19 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: qemu-devel

On 06/30/2013 08:30 PM, Mike Frysinger wrote:
> This avoids needing to execute a program and keeping an (incomplete)
> list when cross-compiling.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

For the benefit of the list, this is a porting of the autoconf test.

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-07-01  3:30 [Qemu-devel] [PATCH] configure: detect endian via compile test Mike Frysinger
  2013-07-02 15:19 ` Richard Henderson
@ 2013-08-28  8:21 ` James Hogan
  2013-09-09 19:30   ` Stefan Weil
  1 sibling, 1 reply; 7+ messages in thread
From: James Hogan @ 2013-08-28  8:21 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: qemu-devel, Richard Henderson

On 1 July 2013 04:30, Mike Frysinger <vapier@gentoo.org> wrote:
> This avoids needing to execute a program and keeping an (incomplete)
> list when cross-compiling.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

This fixes mipsel cross compiling. I also checked it detected a mips
(be) compiler as big endian.

Tested-by: James Hogan <james.hogan@imgtec.com> [mips]

Can somebody please apply this. Maybe for stable too?

Cheers
James

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-08-28  8:21 ` James Hogan
@ 2013-09-09 19:30   ` Stefan Weil
  2013-09-26  3:22     ` Doug Goldstein
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2013-09-09 19:30 UTC (permalink / raw)
  To: James Hogan, Aurélien Jarno, Anthony Liguori
  Cc: Mike Frysinger, qemu-devel, Richard Henderson

Am 28.08.2013 10:21, schrieb James Hogan:
> On 1 July 2013 04:30, Mike Frysinger <vapier@gentoo.org> wrote:
>> This avoids needing to execute a program and keeping an (incomplete)
>> list when cross-compiling. Signed-off-by: Mike Frysinger
>> <vapier@gentoo.org> 
> This fixes mipsel cross compiling. I also checked it detected a mips
> (be) compiler as big endian. Tested-by: James Hogan
> <james.hogan@imgtec.com> [mips] Can somebody please apply this. Maybe
> for stable too? Cheers James 

Ping? Aurelien, Anthony, who wants to commit this patch?
Richard already reviewed it.

See also http://patchwork.ozlabs.org/patch/268687/ for
another configure patch waiting for a commit.

Regards,
Stefan

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-09-09 19:30   ` Stefan Weil
@ 2013-09-26  3:22     ` Doug Goldstein
  2013-09-26 20:54       ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Goldstein @ 2013-09-26  3:22 UTC (permalink / raw)
  To: Stefan Weil
  Cc: James Hogan, Mike Frysinger, qemu-devel, qemu-stable,
	Anthony Liguori, Aurélien Jarno, Richard Henderson

On Mon, Sep 9, 2013 at 2:30 PM, Stefan Weil <stefan.weil@weilnetz.de> wrote:
> Am 28.08.2013 10:21, schrieb James Hogan:
>> On 1 July 2013 04:30, Mike Frysinger <vapier@gentoo.org> wrote:
>>> This avoids needing to execute a program and keeping an (incomplete)
>>> list when cross-compiling. Signed-off-by: Mike Frysinger
>>> <vapier@gentoo.org>
>> This fixes mipsel cross compiling. I also checked it detected a mips
>> (be) compiler as big endian. Tested-by: James Hogan
>> <james.hogan@imgtec.com> [mips] Can somebody please apply this. Maybe
>> for stable too? Cheers James
>
> Ping? Aurelien, Anthony, who wants to commit this patch?
> Richard already reviewed it.
>
> See also http://patchwork.ozlabs.org/patch/268687/ for
> another configure patch waiting for a commit.
>
> Regards,
> Stefan
>
>

Ping on getting this into master (and then over to stable).

-- 
Doug Goldstein

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-09-26  3:22     ` Doug Goldstein
@ 2013-09-26 20:54       ` Paolo Bonzini
  2013-11-05 17:36         ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2013-09-26 20:54 UTC (permalink / raw)
  To: Doug Goldstein, Anthony Liguori, Aurélien Jarno
  Cc: James Hogan, Mike Frysinger, qemu-devel, qemu-stable, Stefan Weil,
	Richard Henderson

Il 26/09/2013 05:22, Doug Goldstein ha scritto:
> On Mon, Sep 9, 2013 at 2:30 PM, Stefan Weil <stefan.weil@weilnetz.de> wrote:
>> Am 28.08.2013 10:21, schrieb James Hogan:
>>> On 1 July 2013 04:30, Mike Frysinger <vapier@gentoo.org> wrote:
>>>> This avoids needing to execute a program and keeping an (incomplete)
>>>> list when cross-compiling. Signed-off-by: Mike Frysinger
>>>> <vapier@gentoo.org>
>>> This fixes mipsel cross compiling. I also checked it detected a mips
>>> (be) compiler as big endian. Tested-by: James Hogan
>>> <james.hogan@imgtec.com> [mips] Can somebody please apply this. Maybe
>>> for stable too? Cheers James
>>
>> Ping? Aurelien, Anthony, who wants to commit this patch?
>> Richard already reviewed it.
>>
>> See also http://patchwork.ozlabs.org/patch/268687/ for
>> another configure patch waiting for a commit.
>>
>> Regards,
>> Stefan
>>
>>
> 
> Ping on getting this into master (and then over to stable).
> 

Thanks Doug.  Anthony, Aurelien, can you commit it?

Paolo

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

* Re: [Qemu-devel] [PATCH] configure: detect endian via compile test
  2013-09-26 20:54       ` Paolo Bonzini
@ 2013-11-05 17:36         ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2013-11-05 17:36 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: James Hogan, Mike Frysinger, qemu-devel, qemu-stable,
	Doug Goldstein, Stefan Weil, Anthony Liguori, Aurélien Jarno,
	Richard Henderson

On 26 September 2013 21:54, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 26/09/2013 05:22, Doug Goldstein ha scritto:
>> On Mon, Sep 9, 2013 at 2:30 PM, Stefan Weil <stefan.weil@weilnetz.de> wrote:
>>> Am 28.08.2013 10:21, schrieb James Hogan:
>>>> On 1 July 2013 04:30, Mike Frysinger <vapier@gentoo.org> wrote:
>>>>> This avoids needing to execute a program and keeping an (incomplete)
>>>>> list when cross-compiling. Signed-off-by: Mike Frysinger
>>>>> <vapier@gentoo.org>
>>>> This fixes mipsel cross compiling. I also checked it detected a mips
>>>> (be) compiler as big endian. Tested-by: James Hogan
>>>> <james.hogan@imgtec.com> [mips] Can somebody please apply this. Maybe
>>>> for stable too? Cheers James
>>>
>>> Ping? Aurelien, Anthony, who wants to commit this patch?
>>> Richard already reviewed it.
>>>
>>> See also http://patchwork.ozlabs.org/patch/268687/ for
>>> another configure patch waiting for a commit.
>>>
>>> Regards,
>>> Stefan
>>>
>>>
>>
>> Ping on getting this into master (and then over to stable).
>>
>
> Thanks Doug.  Anthony, Aurelien, can you commit it?

Ping -- looks like this one got dropped :-(

-- PMM

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

end of thread, other threads:[~2013-11-05 17:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01  3:30 [Qemu-devel] [PATCH] configure: detect endian via compile test Mike Frysinger
2013-07-02 15:19 ` Richard Henderson
2013-08-28  8:21 ` James Hogan
2013-09-09 19:30   ` Stefan Weil
2013-09-26  3:22     ` Doug Goldstein
2013-09-26 20:54       ` Paolo Bonzini
2013-11-05 17:36         ` Peter Maydell

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).