host-pcc: enable building with -m32 or -m64
PATCH 1/1 host-pcc: enable building with -m32 or -m64
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
--- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
configure +8 -1
@@ -807,7 +807,14 @@ case "$cpu" in arm*) host_guest_base="yes" ;; - ppc*) + ppc) + QEMU_CFLAGS="-m32 $QEMU_CFLAGS" + LDFLAGS="-m32 $LDFLAGS" + host_guest_base="yes" + ;; + ppc64) + QEMU_CFLAGS="-m64 $QEMU_CFLAGS" + LDFLAGS="-m64 $LDFLAGS" host_guest_base="yes" ;; mips*)
Quoted 21 lines · Stefan Berger
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
Signed-off-by Stefan Berger <[email protected]>--- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)Index: qemu-git/configure
===================================================================configure +1
-1@@ -807,7 +807,14 @@ case "$cpu" in arm*) host_guest_base="yes" ;; - ppc*) + ppc)
configure case "$cpu" in · line 820
Quoted 10 lines
configure +7
-0+ QEMU_CFLAGS="-m32 $QEMU_CFLAGS" + LDFLAGS="-m32 $LDFLAGS" + host_guest_base="yes" + ;; + ppc64) + QEMU_CFLAGS="-m64 $QEMU_CFLAGS" + LDFLAGS="-m64 $LDFLAGS" host_guest_base="yes" ;; mips*)
This isn't right, if one has particular toolchain and wants to build something that defaults to a different bitlength he should be able to do that, this patch attempts to outsmart the defaults and furthermore prevents one from overriding the settings.
P.S. host-pcc... pcc?
P.P.S. On the ppc64 machine i have, gcc defaults to 32bit and for a
good reason - 64bit code is quite a bit slower when running typical workloads (64bit guest not being one of them though)
Signature · 1 line
mailto:[email protected]
Quoted 38 lines · malc
Quoted 21 lines · Stefan Berger
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
Signed-off-by Stefan Berger<[email protected]>--- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)Index: qemu-git/configure
===================================================================configure +1
-1@@ -807,7 +807,14 @@ case "$cpu" in arm*) host_guest_base="yes" ;; - ppc*) + ppc)configure case "$cpu" in · line 820
Quoted 10 lines
configure +7
-0+ QEMU_CFLAGS="-m32 $QEMU_CFLAGS" + LDFLAGS="-m32 $LDFLAGS" + host_guest_base="yes" + ;; + ppc64) + QEMU_CFLAGS="-m64 $QEMU_CFLAGS" + LDFLAGS="-m64 $LDFLAGS" host_guest_base="yes" ;; mips*)This isn't right, if one has particular toolchain and wants to build something that defaults to a different bitlength he should be able to do that, this patch attempts to outsmart the defaults and furthermore prevents one from overriding the settings.
Quoted 6 lines
P.S. host-pcc... pcc?
P.P.S. On the ppc64 machine i have, gcc defaults to 32bit and for a
good reason - 64bit code is quite a bit slower when running typical workloads (64bit guest not being one of them though)
Is it possible to change my ppc64 gcc compiler to produce 32bit binaries by default -- how? I'd like to test this case because for me not passing any parameters via --extra-cflags defaults to the ppc64 case above - obviously it will produce 64 bit binaries by default. -m32 then ends up in the ppc) case, -m64 again in the ppc64) case.
Stefan
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
Andreas
Quoted 26 lines
Signed-off-by Stefan Berger <[email protected]>---
configure | 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)Index: qemu-git/configure
===================================================================configure +8
-1@@ -807,7 +807,14 @@ case "$cpu" in arm*) host_guest_base="yes" ;; - ppc*) + ppc) + QEMU_CFLAGS="-m32 $QEMU_CFLAGS" + LDFLAGS="-m32 $LDFLAGS" + host_guest_base="yes" + ;; + ppc64) + QEMU_CFLAGS="-m64 $QEMU_CFLAGS" + LDFLAGS="-m64 $LDFLAGS" host_guest_base="yes" ;; mips*)
Quoted 9 lines · Andreas Färber
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]
The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
Stefan
Quoted 31 lines
Andreas
Quoted 26 lines
Signed-off-by Stefan Berger <[email protected]>---
configure | 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)Index: qemu-git/configure
===================================================================configure +8
-1@@ -807,7 +807,14 @@ case "$cpu" in arm*) host_guest_base="yes" ;; - ppc*) + ppc) + QEMU_CFLAGS="-m32 $QEMU_CFLAGS" + LDFLAGS="-m32 $LDFLAGS" + host_guest_base="yes" + ;; + ppc64) + QEMU_CFLAGS="-m64 $QEMU_CFLAGS" + LDFLAGS="-m64 $LDFLAGS" host_guest_base="yes" ;; mips*)
Quoted 26 lines · Stefan Berger
Quoted 11 lines · Andreas F?rber
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 3 lines
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]
Quoted 3 lines
The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
[..snip..]
You can just do `./configure --cc="gcc -m[32|64]"'
Signature · 1 line
mailto:[email protected]
Am 26.05.2011 um 22:31 schrieb Stefan Berger:
Quoted 15 lines · Andreas Färber
Quoted 8 lines
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
Quoted 7 lines
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
Erm, you did try --extra-ldflags for LDFLAGS, did you? That --extra-cflags doesn't end up there is intentional!
Andreas
Quoted 24 lines · Andreas Färber
Am 26.05.2011 um 22:31 schrieb Stefan Berger:
Quoted 22 lines · Andreas Färber
Quoted 9 lines
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]
Quoted 5 lines
Quoted 1 line
The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
Erm, you did try --extra-ldflags for LDFLAGS, did you? That --extra-cflags doesn't end up there is intentional!
No, I didn't. Here's what happened. On x86_64 host I used to be able to compile 32bit executables with --extra-cflags="-m32". That stopped working when libcacard showed up -- I posted a patch today -- only the linking of vscclient in libcacard/ didn't work. The "work-around" before the patch was --disable-smartcard. Now taking that same habit of passing --extra-cflags="-m32" to the ppc64 machine again didn't work, but was broken somewhere else. So this is where this is all coming from.
Stefan
Quoted 1 line
Andreas
Am 27.05.2011 um 00:25 schrieb Stefan Berger:
Quoted 26 lines · Andreas Färber
Quoted 25 lines
Am 26.05.2011 um 22:31 schrieb Stefan Berger:
Quoted 23 lines · Andreas Färber
Quoted 10 lines
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra- cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
Erm, you did try --extra-ldflags for LDFLAGS, did you? That --extra-cflags doesn't end up there is intentional!
No, I didn't. Here's what happened. On
x86_64host I used to be able to compile 32bit executables with --extra-cflags="-m32". That stopped working when libcacard showed up -- I posted a patch today -- only the linking of vscclient in libcacard/ didn't work. The
"work-around" before the patch was --disable-smartcard. Now taking that same habit of passing --extra-cflags="-m32" to the ppc64 machine again didn't work, but was broken somewhere else. So this is where this is all coming from.
Stefan, I rather care about where this is going, and my unanswered question is: Does it work if you use --extra-cflags=-m32 --extra-ldflags=-m32? If yes, then we can drop this patch and be good. Otherwise we need to think about a better solution.
Andreas
Quoted 30 lines · Andreas Färber
Am 27.05.2011 um 00:25 schrieb Stefan Berger:
Quoted 28 lines · Andreas Färber
Quoted 27 lines
Am 26.05.2011 um 22:31 schrieb Stefan Berger:
Quoted 24 lines · Andreas Färber
Quoted 9 lines
Am 26.05.2011 um 21:00 schrieb Stefan Berger:
Quoted 1 line
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
You probably meant "without passing"?
Nack. Please don't hardcode -mXX in configure, it's -arch ppc vs. -arch ppc64 on my host/gcc. What's wrong with passing --extra-cflags?
I posted the following patch today for compiling libcacard with -m32 on a 64 bit machine.
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
It adds LDFLAGS. This works fine on x86-64. Then trying this out on ppc64 with -m32 in extra-cflags I find the following in config-host.mak
[...]
HELPER_CFLAGS=
LDFLAGS=-Wl,--warn-common -g
ARLIBS_BEGIN=
[...]The -m32 doesn't make it into LDFLAGS. The below patch fixed it for me following the pattern of x86-64 and i686 a bit further up in the case statement in configure.
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines
Erm, you did try --extra-ldflags for LDFLAGS, did you? That --extra-cflags doesn't end up there is intentional!
No, I didn't. Here's what happened. On
x86_64host I used to be able to compile 32bit executables with --extra-cflags="-m32". That stopped working when libcacard showed up -- I posted a patch today -- only the linking of vscclient in libcacard/ didn't work. The "work-around" before the patch was --disable-smartcard. Now taking that same habit of passing --extra-cflags="-m32" to the ppc64 machine again didn't work, but was broken somewhere else. So this is where this is all coming from.Stefan, I rather care about where this is going, and my unanswered question is: Does it work if you use --extra-cflags=-m32 --extra-ldflags=-m32?
If yes, then we can drop this patch and be good. Otherwise we need to think about a better solution.
It works as you show above once this patch here has been applied:
http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02909.html
Stefan
Quoted 22 lines · Stefan Berger
With the below patch I can build either ppc (-m32) or ppc64 (-m64) versions of Qemu (on a ppc64 host) when passing these compiler flags via 'configure ... --extra-cflags="-m32"'.
Signed-off-by Stefan Berger <[email protected]>---
configure | 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)Index: qemu-git/configure
===================================================================configure +0
-0@@ -807,7 +807,14 @@ case "$cpu" in arm*)host_guest_base="yes"
;;
- ppc*)
+ ppc)
+ QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
+ LDFLAGS="-m32 $LDFLAGS"
Quoted 8 lines
+ host_guest_base="yes"
+ ;;
+ ppc64)
+ QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
+ LDFLAGS="-m64 $LDFLAGS"
host_guest_base="yes"
;;
mips*)
The patch doesn't seem to match the description. I would have guessed that with this patch you _do not_ need to pass these compiler flags via --extra-cflags anymore.
Also, -m32/-m64 are really CPPFLAGS, not CFLAGS since they affect also the compiler's include path.
Paolo