john.levon@sun.com
2007-Aug-15 14:20 UTC
[Xen-devel] [PATCH] Fix 64-bit foreign header check
# 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" _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
john.levon@sun.com
2007-Aug-16 13:23 UTC
[Xen-devel] [PATCH] Fix 64-bit foreign header check
# 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 $@ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel