All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix 64-bit foreign header check
@ 2007-08-15 14:20 john.levon
  2007-08-15 14:24 ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: john.levon @ 2007-08-15 14:20 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User john.levon@sun.com
# Date 1187187471 25200
# Node ID ce1e8719a4d8c2d9051e60e14213550ba0eb3809
# Parent  3177ef0cc3ecc27051af5b3cbba72b3e42a26b68
Fix 64-bit foreign header check

If a 64-bit build is chosen, we need to compile the checker program with -m64.
Use CFLAGS instead of HOSTCFLAGS (this check doesn't work under a
cross-compile anyway).

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/xen/include/public/foreign/Makefile b/xen/include/public/foreign/Makefile
--- a/xen/include/public/foreign/Makefile
+++ b/xen/include/public/foreign/Makefile
@@ -18,7 +18,7 @@ check-headers: checker
 	./checker > $(XEN_TARGET_ARCH).size
 	diff -u reference.size $(XEN_TARGET_ARCH).size
 checker: checker.c $(headers)
-	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+	$(CC) $(CFLAGS) -o $@ $<
 else
 check-headers:
 	@echo "cross build: skipping check"

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 14:20 [PATCH] Fix 64-bit foreign header check john.levon
@ 2007-08-15 14:24 ` Keir Fraser
  2007-08-15 14:37   ` John Levon
  0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2007-08-15 14:24 UTC (permalink / raw)
  To: john.levon, xen-devel

On 15/8/07 15:20, "john.levon@sun.com" <john.levon@sun.com> wrote:

> Fix 64-bit foreign header check
> 
> If a 64-bit build is chosen, we need to compile the checker program with -m64.
> Use CFLAGS instead of HOSTCFLAGS (this check doesn't work under a
> cross-compile anyway).

Won't gcc produce 64-bit binaries by default in a 64-bit environment? Which
must be the case if you have TARGET_ARCH==COMPILE_ARCH, and the target arch
is 64-bit.

 -- Keir

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 14:24 ` Keir Fraser
@ 2007-08-15 14:37   ` John Levon
  2007-08-15 14:59     ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: John Levon @ 2007-08-15 14:37 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Wed, Aug 15, 2007 at 03:24:45PM +0100, Keir Fraser wrote:

> > Fix 64-bit foreign header check
> > 
> > If a 64-bit build is chosen, we need to compile the checker program with -m64.
> > Use CFLAGS instead of HOSTCFLAGS (this check doesn't work under a
> > cross-compile anyway).
> 
> Won't gcc produce 64-bit binaries by default in a 64-bit environment?

There is no such thing as a "64-bit environment" on Solaris, all machines ship
with both 32 and 64 bit functionality (of course the kernel must be 64-bit to
actually /use/ such).

Thus we build twice, once in 32-bit, once in 64-bit.

regards,
john

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 14:37   ` John Levon
@ 2007-08-15 14:59     ` Keir Fraser
  2007-08-15 15:27       ` John Levon
  0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2007-08-15 14:59 UTC (permalink / raw)
  To: John Levon; +Cc: xen-devel

On 15/8/07 15:37, "John Levon" <john.levon@sun.com> wrote:

>> Won't gcc produce 64-bit binaries by default in a 64-bit environment?
> 
> There is no such thing as a "64-bit environment" on Solaris, all machines ship
> with both 32 and 64 bit functionality (of course the kernel must be 64-bit to
> actually /use/ such).
> 
> Thus we build twice, once in 32-bit, once in 64-bit.

Then isn't your TARGET_ARCH!=COMPILE_ARCH for one of these builds? Sounds
like you have a 32-bit-ish compile environment (since you produce 32-bit
binaries by default), and hence it would be correct to have
COMPILE_ARCH==x86_32 for both builds.

 -- Keir

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 14:59     ` Keir Fraser
@ 2007-08-15 15:27       ` John Levon
  2007-08-15 16:04         ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: John Levon @ 2007-08-15 15:27 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Wed, Aug 15, 2007 at 03:59:49PM +0100, Keir Fraser wrote:

> >> Won't gcc produce 64-bit binaries by default in a 64-bit environment?
> > 
> > There is no such thing as a "64-bit environment" on Solaris, all machines ship
> > with both 32 and 64 bit functionality (of course the kernel must be 64-bit to
> > actually /use/ such).
> > 
> > Thus we build twice, once in 32-bit, once in 64-bit.
> 
> Then isn't your TARGET_ARCH!=COMPILE_ARCH for one of these builds? Sounds
> like you have a 32-bit-ish compile environment (since you produce 32-bit
> binaries by default), and hence it would be correct to have
> COMPILE_ARCH==x86_32 for both builds.

There is no such "32-bit" environment, we can always produce both.  What you're
suggesting sounds like a cross-compile. This is absolutely not a cross compile;
in particular we can and do want this header check to happen.

We set XEN_COMPILE_ARCH by hand to 64-bit since the Xen makefiles have the notion
that uname has anything to do with 32 or 64 bitness (a Linux-ism; in fact an
x86_64-Linux-ism, since I believe other Linux arches do it the traditional
way).

regards
john

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 15:27       ` John Levon
@ 2007-08-15 16:04         ` Keir Fraser
  2007-08-15 16:08           ` John Levon
  2007-08-15 16:09           ` John Levon
  0 siblings, 2 replies; 10+ messages in thread
From: Keir Fraser @ 2007-08-15 16:04 UTC (permalink / raw)
  To: John Levon; +Cc: xen-devel

On 15/8/07 16:27, "John Levon" <john.levon@sun.com> wrote:

> There is no such "32-bit" environment, we can always produce both.  What
> you're
> suggesting sounds like a cross-compile. This is absolutely not a cross
> compile;
> in particular we can and do want this header check to happen.
> 
> We set XEN_COMPILE_ARCH by hand to 64-bit since the Xen makefiles have the
> notion
> that uname has anything to do with 32 or 64 bitness (a Linux-ism; in fact an
> x86_64-Linux-ism, since I believe other Linux arches do it the traditional
> way).

Hmmm... Well varying COMPILE_ARCH when the compile arch is not actually
changing seems dodgy to me.

In any case, binaries that run on the compile host should build with
HOSTCC/HOSTCFLAGS. That seems a pretty simple and obvious rule that I do not
want to introduce exceptions to.

 -- Keir

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 16:04         ` Keir Fraser
@ 2007-08-15 16:08           ` John Levon
  2007-08-16  7:15             ` Keir Fraser
  2007-08-15 16:09           ` John Levon
  1 sibling, 1 reply; 10+ messages in thread
From: John Levon @ 2007-08-15 16:08 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Wed, Aug 15, 2007 at 05:04:30PM +0100, Keir Fraser wrote:

> > There is no such "32-bit" environment, we can always produce both.  What
> > you're
> > suggesting sounds like a cross-compile. This is absolutely not a cross
> > compile;
> > in particular we can and do want this header check to happen.
> > 
> > We set XEN_COMPILE_ARCH by hand to 64-bit since the Xen makefiles have the
> > notion
> > that uname has anything to do with 32 or 64 bitness (a Linux-ism; in fact an
> > x86_64-Linux-ism, since I believe other Linux arches do it the traditional
> > way).
> 
> Hmmm... Well varying COMPILE_ARCH when the compile arch is not actually
> changing seems dodgy to me.
>
> In any case, binaries that run on the compile host should build with
> HOSTCC/HOSTCFLAGS. That seems a pretty simple and obvious rule that I do not
> want to introduce exceptions to.

Can you please explain what you want us to do.

john

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 16:04         ` Keir Fraser
  2007-08-15 16:08           ` John Levon
@ 2007-08-15 16:09           ` John Levon
  1 sibling, 0 replies; 10+ messages in thread
From: John Levon @ 2007-08-15 16:09 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Wed, Aug 15, 2007 at 05:04:30PM +0100, Keir Fraser wrote:

> In any case, binaries that run on the compile host should build with
> HOSTCC/HOSTCFLAGS. That seems a pretty simple and obvious rule that I do not
> want to introduce exceptions to.

And besides, this is irrelevant since that code does not run under a
cross-compile, so trying to pretend there's some difference makes no sense.

john

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

* Re: [PATCH] Fix 64-bit foreign header check
  2007-08-15 16:08           ` John Levon
@ 2007-08-16  7:15             ` Keir Fraser
  0 siblings, 0 replies; 10+ messages in thread
From: Keir Fraser @ 2007-08-16  7:15 UTC (permalink / raw)
  To: John Levon; +Cc: xen-devel

On 15/8/07 17:08, "John Levon" <john.levon@sun.com> wrote:

>> Hmmm... Well varying COMPILE_ARCH when the compile arch is not actually
>> changing seems dodgy to me.
>> 
>> In any case, binaries that run on the compile host should build with
>> HOSTCC/HOSTCFLAGS. That seems a pretty simple and obvious rule that I do not
>> want to introduce exceptions to.
> 
> Can you please explain what you want us to do.

When you modify COMPILE_ARCH to x86_64, you should also modify HOSTCFLAGS to
include -m64. We can set HOSTCC/HOSTCFLAGS with '?=' assignment for this
purpose, in Config.mk. Or, perhaps better, you can set both COMPILE_ARCH and
HOSTCC/HOSTCFLAGS as you like in config/SunOS.mk based on XEN_TARGET_ARCH,
if that's always the sane thing to do on Solaris.

 -- Keir

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

* [PATCH] Fix 64-bit foreign header check
@ 2007-08-16 13:23 john.levon
  0 siblings, 0 replies; 10+ messages in thread
From: john.levon @ 2007-08-16 13:23 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User john.levon@sun.com
# Date 1187270597 25200
# Node ID f78511fe84879f080875738ddf29081ee30ef0b1
# Parent  e3c3b44f29ad067c8a25e58c0e35265fe64eaa38
Fix 64-bit foreign header check

If a 64-bit build is chosen, we need to compile the checker program with -m64.
Since the Xen build doesn't support multilib GCC on Linux, hack it in for
Solaris for altering HOSTCFLAGS appropriately.

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/config/SunOS.mk b/config/SunOS.mk
--- a/config/SunOS.mk
+++ b/config/SunOS.mk
@@ -35,6 +35,12 @@ endif
 
 CFLAGS += -Wa,--divide -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__
 
+# We don't support cross-compiling, as we need to force the host compiler into
+# 64-bit mode as necessary: the foreign header check uses HOSTCFLAGS.
+HOSTCFLAGS_x86_32 = -m32
+HOSTCFLAGS_x86_64 = -m64
+HOSTCFLAGS += $(HOSTCFLAGS_$(XEN_TARGET_ARCH))
+
 CTFCONVERT = $(SOLARIS_BUILD_TOOLS)/onbld/bin/i386/ctfconvert
 CTFMERGE = $(SOLARIS_BUILD_TOOLS)/onbld/bin/i386/ctfmerge
 POST_PROCESS_O= $(CTFCONVERT) -i -L XEN_FULLVERSION $@

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

end of thread, other threads:[~2007-08-16 13:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 14:20 [PATCH] Fix 64-bit foreign header check john.levon
2007-08-15 14:24 ` Keir Fraser
2007-08-15 14:37   ` John Levon
2007-08-15 14:59     ` Keir Fraser
2007-08-15 15:27       ` John Levon
2007-08-15 16:04         ` Keir Fraser
2007-08-15 16:08           ` John Levon
2007-08-16  7:15             ` Keir Fraser
2007-08-15 16:09           ` John Levon
  -- strict thread matches above, loose matches on Subject: below --
2007-08-16 13:23 john.levon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.