configure: change endian cross compilation test
PATCH 1/1 configure: change endian cross compilation test
From: Stuart Yoder <[email protected]>
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.
--- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -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
Signature · 1 line
1.7.3.4
Quoted 9 lines
From: Stuart Yoder <[email protected]>
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
2012/3/14 Paul Brook <[email protected]>:
Quoted 6 lines
Quoted 6 lines
From: Stuart Yoder <[email protected]>
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.
Quoted 6 lines
Quoted 2 lines
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
A message that is not in the archive (sent off-list or not yet received): CALRxmdAhwT-2p2VaO2mpN7sLr46BTBZRBkXsWWpoCd=UBH5PNQ@mail.gmail.com
[added qemu-devel back again]
Quoted 9 lines · Stuart Yoder
Quoted 4 lines · Peter Maydell
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:
Quoted 12 lines
# 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
Am 14.03.2012 19:09, schrieb Peter Maydell:
Quoted 23 lines
[added qemu-devel back again]
Quoted 8 lines · Stuart Yoder
Quoted 4 lines · Peter Maydell
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:
Quoted 12 lines
# 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
Quoted 7 lines
No, I'm proposing that you find out what the right
check_definefor 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.