[6443] Enabled building of x86_64 code on Mac OS X (Alexander Graf)
Revision: 6443
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6443 Author: aliguori Date: 2009-01-26 15:37:40 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
Enabled building of x86_64 code on Mac OS X (Alexander Graf)
Mac OS X 10.5 supports 64-bit userspace on an x86_64 kernel and by default uses 32-bit userspace applications, so the detection for the host architecture fails.
This patch enabled building of x86_64 code on x86_64 capable CPUS with Mac OS X.
Modified Paths:
--------------
trunk/configure
Modified: trunk/configure
===================================================================
configure +11 -1
@@ -243,11 +243,21 @@ Darwin) bsd="yes" darwin="yes" +# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code +is_x86_64=`sysctl -n hw.optional.x86_64` +if [ "$is_x86_64" = "1" ]; then + cpu=x86_64 +fi +if [ "$cpu" = "x86_64" ] ; then + OS_CFLAGS="-arch x86_64" + LDFLAGS="-arch x86_64" +else + OS_CFLAGS="-mdynamic-no-pic" +fi darwin_user="yes" cocoa="yes" audio_drv_list="coreaudio" audio_possible_drivers="coreaudio sdl fmod" -OS_CFLAGS="-mdynamic-no-pic" OS_LDFLAGS="-framework CoreFoundation -framework IOKit" ;; SunOS)
Am 26.01.2009 um 16:37 schrieb Anthony Liguori:
Quoted 30 lines
Revision: 6443
http://svn.sv.gnu.org/viewvc/? view=rev&root=qemu&revision=6443 Author: aliguori Date: 2009-01-26 15:37:40 +0000 (Mon, 26 Jan 2009)Log Message:
-----------
Enabled building ofx86_64code on Mac OS X (Alexander Graf)Mac OS X 10.5 supports 64-bit userspace on an
x86_64kernel and by default uses 32-bit userspace applications, so the detection for the host architecture fails.This patch enabled building of
x86_64code onx86_64capable CPUS with Mac OS X.Signed-off-by Alexander Graf <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------
trunk/configureModified: trunk/configure
===================================================================configure +0
-0@@ -243,11 +243,21 @@ Darwin)
Quoted 5 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code +is_x86_64=sysctl -n hw.optional.x86_64
This results in an error message on OSX/ppc:
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
configure +1 -1
@@ -244,7 +244,7 @@ Darwin) bsd="yes" darwin="yes" # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code -is_x86_64=`sysctl -n hw.optional.x86_64` +is_x86_64=`sysctl -n hw.optional.x86_64 2>/dev/null` if [ "$is_x86_64" = "1" ]; then cpu=x86_64 fi
Quoted 24 lines
configure +9
-0+if [ "$is_x86_64" = "1" ]; then + cpu=x86_64 +fi +if [ "$cpu" = "x86_64" ] ; then + OS_CFLAGS="-arch x86_64" + LDFLAGS="-arch x86_64" +else + OS_CFLAGS="-mdynamic-no-pic" +fidarwin_user="yes"
cocoa="yes"
audio_drv_list="coreaudio" audio_possible_drivers="coreaudio sdl fmod" -OS_CFLAGS="-mdynamic-no-pic" OS_LDFLAGS="-framework CoreFoundation -framework IOKit" ;;
SunOS)
Am 01.02.2009 um 13:06 schrieb Andreas Färber:
Quoted 41 lines
Am 26.01.2009 um 16:37 schrieb Anthony Liguori:
Quoted 30 lines
Revision: 6443
http://svn.sv.gnu.org/viewvc/? view=rev&root=qemu&revision=6443 Author: aliguori Date: 2009-01-26 15:37:40 +0000 (Mon, 26 Jan 2009)Log Message:
-----------
Enabled building ofx86_64code on Mac OS X (Alexander Graf)Mac OS X 10.5 supports 64-bit userspace on an
x86_64kernel and by default uses 32-bit userspace applications, so the detection for the host architecture fails.This patch enabled building of
x86_64code onx86_64capable CPUS with Mac OS X.Signed-off-by Alexander Graf <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------
trunk/configureModified: trunk/configure
===================================================================configure +0
-0@@ -243,11 +243,21 @@ Darwin)Quoted 5 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code +is_x86_64=sysctl -n hw.optional.x86_64This results in an error message on OSX/ppc:
Quoted 6 lines
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
<qemu-x64-ppc.diff>
My patch still applies cleanly against r6638. Please apply.
It's trivial, but in any case:
Silence x64 check on OSX/ppc.
The check for x86_64 on Mac OS X results in an error message on ppc:
second level name optional in hw.optional.x86_64 is invalid
Suppress this message by redirecting error output.
---
configure +0 -0
@@ -244,7 +244,7 @@ Darwin) bsd="yes" darwin="yes" # on Leopard most of the system is 32-bit, so we have to ask the
kernel it if we can run 64-bit userspace code -is_x86_64=sysctl -n hw.optional.x86_64 +is_x86_64=sysctl -n hw.optional.x86_64 2>/dev/null
if [ "$is_x86_64" = "1" ]; then
cpu=x86_64
fi
Alexander Graf
Acked-byQuoted 58 lines · Andreas Färber
Am 01.02.2009 um 13:06 schrieb Andreas Färber:
Quoted 41 lines
Am 26.01.2009 um 16:37 schrieb Anthony Liguori:
Quoted 30 lines
Revision: 6443
http://svn.sv.gnu.org/viewvc/? view=rev&root=qemu&revision=6443 Author: aliguori Date: 2009-01-26 15:37:40 +0000 (Mon, 26 Jan 2009)Log Message:
-----------
Enabled building ofx86_64code on Mac OS X (Alexander Graf)Mac OS X 10.5 supports 64-bit userspace on an
x86_64kernel and by default uses 32-bit userspace applications, so the detection for the host architecture fails.This patch enabled building of
x86_64code onx86_64capable CPUS with Mac OS X.Signed-off-by Alexander Graf <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------
trunk/configureModified: trunk/configure
===================================================================configure +0
-0@@ -243,11 +243,21 @@ Darwin)Quoted 5 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code +is_x86_64=sysctl -n hw.optional.x86_64This results in an error message on OSX/ppc:
Quoted 6 lines
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
<qemu-x64-ppc.diff>My patch still applies cleanly against r6638. Please apply.
It's trivial, but in any case:
Silence x64 check on OSX/ppc.
Quoted 7 lines
The check for
x86_64on Mac OS X results in an error message on ppc:second level name optional in hw.optional.x86_64 is invalid
Suppress this message by redirecting error output.
Signed-off-by Andreas Faerber <[email protected]>
I haven't compile tested it, but it looks pretty obvious :-).
Alex
Quoted 17 lines
---
configure +0
-0@@ -244,7 +244,7 @@ Darwin)bsd="yes"
darwin="yes"# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace codeconfigure +1
-1-is_x86_64=`sysctl -n hw.optional.x86_64` +is_x86_64=`sysctl -n hw.optional.x86_64 2>/dev/null`if [ "$is_x86_64" = "1" ]; then
cpu=x86_64fi
Why not to just simply compile a multiarchitecture fat?
It is possible in 10.4 and 10.5 SDKs to compile at the same time ppc, ppc64, ia32 and x86_64 fully independent of what cpu is running. On execute time the OS will choose the most adequate.
And remember:
64 bit WILL NOT COMPILE COCOA, this is not implemented until 10.6 SDK.
DEPENDENCIES MUST HAVE THESE ARCHITECTURES AVAILABLE (eg. libSDL, if it is not compiled x86_64, linking will fail).
Quoted 96 lines · Alexander Graf
Quoted 58 lines · Andreas Färber
Am 01.02.2009 um 13:06 schrieb Andreas Färber:
Quoted 41 lines
Am 26.01.2009 um 16:37 schrieb Anthony Liguori:
Quoted 30 lines
Revision: 6443
http://svn.sv.gnu.org/viewvc/? view=rev&root=qemu&revision=6443 Author: aliguori Date: 2009-01-26 15:37:40 +0000 (Mon, 26 Jan 2009)Log Message:
-----------
Enabled building ofx86_64code on Mac OS X (Alexander Graf)Mac OS X 10.5 supports 64-bit userspace on an
x86_64kernel and by default uses 32-bit userspace applications, so the detection for the host architecture fails.This patch enabled building of
x86_64code onx86_64capable CPUS with Mac OS X.Signed-off-by Alexander Graf <[email protected]>Signed-off-by Anthony Liguori <[email protected]>Modified Paths:
--------------
trunk/configureModified: trunk/configure
===================================================================configure +0
-0@@ -243,11 +243,21 @@ Darwin)Quoted 5 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code +is_x86_64=sysctl -n hw.optional.x86_64This results in an error message on OSX/ppc:
Quoted 6 lines
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
<qemu-x64-ppc.diff>My patch still applies cleanly against r6638. Please apply.
It's trivial, but in any case:
Silence x64 check on OSX/ppc.
Quoted 7 lines
The check for
x86_64on Mac OS X results in an error message on ppc:second level name optional in hw.optional.x86_64 is invalid
Suppress this message by redirecting error output.
Signed-off-by Andreas Faerber <[email protected]>Acked-by Alexander Graf <[email protected]>I haven't compile tested it, but it looks pretty obvious :-).
Alex
Quoted 17 lines
---
configure +0
-0@@ -244,7 +244,7 @@ Darwin)bsd="yes"
darwin="yes"# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace codeconfigure +1
-1-is_x86_64=`sysctl -n hw.optional.x86_64` +is_x86_64=`sysctl -n hw.optional.x86_64 2>/dev/null`if [ "$is_x86_64" = "1" ]; then
cpu=x86_64
fi
Am 22.02.2009 um 16:50 schrieb Natalia Portillo:
Quoted 3 lines
Why not to just simply compile a multiarchitecture fat?
It is possible in 10.4 and 10.5 SDKs to compile at the same time ppc, ppc64, ia32 andx86_64fully independent of what cpu is running. On execute time the OS will choose the most adequate.
Often due to autoconf et al. it is necessary to postprocess using the lipo tool instead of directly passing multiple architectures to GCC. QEMU's configure detects the endianness for instance, so building a classical Universal Binary (ppc+i386) seems destined to fail...
Anyway, having a ppc64 binary in the bundle would on a G5 unconditionally run the 64-bit version, independent of whether that makes sense (e.g., 32-bit guest w/ <4GB RAM). Loading a 64-bit address consumes 5 instructions compared to 2 in 32-bit userland; on amd64 it probably makes more sense.
Quoted 1 line
64 bit WILL NOT COMPILE COCOA, this is not implemented until 10.6 SDK.
I thought it was a feature of v10.5?
Cf. http://www.apple.com/macosx/technology/64bit.html
Andreas
Am 22.02.2009 um 16:21 schrieb Alexander Graf:
Quoted 9 lines · Andreas Färber
Quoted 7 lines
Silence x64 check on OSX/ppc.
The check for
x86_64on Mac OS X results in an error message on ppc:second level name optional in hw.optional.x86_64 is invalid
Quoted 7 lines
Quoted 3 lines
Suppress this message by redirecting error output.
Signed-off-by Andreas Faerber <[email protected]>Acked-by Alexander Graf <[email protected]>I haven't compile tested it, but it looks pretty obvious :-).
Thanks, I haven't tested it on x86_64 either, but I hope it doesn't break. ;-)
Andreas
On Sun, 22 Feb 2009, Andreas F?rber wrote:
[..snip..]
Quoted 43 lines
Quoted 8 lines
Quoted 5 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
+is_x86_64=sysctl -n hw.optional.x86_64This results in an error message on OSX/ppc:
Quoted 6 lines
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
<qemu-x64-ppc.diff>My patch still applies cleanly against r6638. Please apply.
It's trivial, but in any case:
Silence x64 check on OSX/ppc.
The check for
x86_64on Mac OS X results in an error message on ppc:second level name optional in hw.optional.x86_64 is invalid
Suppress this message by redirecting error output.
Signed-off-by Andreas Faerber <[email protected]>---
configure +0
-0@@ -244,7 +244,7 @@ Darwin)bsd="yes"
darwin="yes"# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace codeconfigure +1
-1-is_x86_64=`sysctl -n hw.optional.x86_64` +is_x86_64=`sysctl -n hw.optional.x86_64 2>/dev/null`if [ "$is_x86_64" = "1" ]; then
Quoted 4 lines
cpu=x86_64fi
It does silence it, but it will also silence any useful warning/error messages should there be any, perhaps there's some other way?
Signature · 1 line
mailto:[email protected]
Quoted 47 lines · malc
On Sun, 22 Feb 2009, Andreas F?rber wrote:
[..snip..]
Quoted 43 lines
Quoted 9 lines
Quoted 6 lines
bsd="yes"
darwin="yes"
+# on Leopard most of the system is 32-bit, so we have to ask the kernel
it if we can run 64-bit userspace code +is_x86_64=sysctl -n hw.optional.x86_64This results in an error message on OSX/ppc:
Quoted 6 lines
second level name optional in hw.optional.x86_64 is invalid
The attached patch silences this error output.
Andreas
<qemu-x64-ppc.diff>My patch still applies cleanly against r6638. Please apply.
It's trivial, but in any case:
Silence x64 check on OSX/ppc.
The check for
x86_64on Mac OS X results in an error message on ppc:second level name optional in hw.optional.x86_64 is invalid
Suppress this message by redirecting error output.
Signed-off-by Andreas Faerber <[email protected]>---
configure +0
-0@@ -244,7 +244,7 @@ Darwin)bsd="yes"
darwin="yes"# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace codeconfigure +1
-1-is_x86_64=`sysctl -n hw.optional.x86_64` +is_x86_64=`sysctl -n hw.optional.x86_64 2>/dev/null`
Quoted 8 lines
Quoted 5 lines
if [ "$is_x86_64" = "1" ]; then
cpu=x86_64
fiIt does silence it, but it will also silence any useful warning/error messages should there be any, perhaps there's some other way?
There shouldn't be any useful warning/error messages from sysctl. It's always there and can be run by any user. IMHO this approach is the easiest you can get. Of course, you could try and check uname for i386 and only then decide if you want to go for x86_64, but I don't see any reason to make things more complicated than they have to be.
Alex
Quoted 8 lines · Andreas Färber
Am 22.02.2009 um 16:50 schrieb Natalia Portillo:
Quoted 3 lines
Why not to just simply compile a multiarchitecture fat?
It is possible in 10.4 and 10.5 SDKs to compile at the same time ppc, ppc64, ia32 andx86_64fully independent of what cpu is running. On execute time the OS will choose the most adequate.Often due to autoconf et al. it is necessary to postprocess using the
lipotool instead of directly passing multiple architectures to GCC. QEMU's configure detects the endianness for instance, so building a classical Universal Binary (ppc+i386) seems destined to fail...
Creating a universal binary is more hassle than it's worth IMHO. But if anyone wants to take on the challenge, I won't keep him.
Quoted 1 line
Anyway, having a ppc64 binary in the bundle would on a G5 unconditionally run the 64-bit version, independent of whether that makes sense (e.g., 32-bit guest w/ <4GB RAM). Loading a 64-bit address consumes 5 instructions compared to 2 in 32-bit userland; on amd64 it probably makes more sense.
I agree here. 64-bit makes a _lot_ more sense on x86_64. You get more registers and other neat features (like direct read of rip).
Quoted 4 lines
Quoted 1 line
64 bit WILL NOT COMPILE COCOA, this is not implemented until 10.6 SDK.
I thought it was a feature of v10.5?
Cf. http://www.apple.com/macosx/technology/64bit.html
It worked fine last time I checked. For me cocoa compilation is broken right now (x86 and x86_64 alike), but there was an unbreaking fix on the list somewhere :)
Alex