All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] Fix 32bit xen-tools build.
@ 2006-10-05  8:48 kraxel
  2006-10-05  8:55 ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: kraxel @ 2006-10-05  8:48 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: cross-build-fix.diff --]
[-- Type: text/plain, Size: 2105 bytes --]

This fixes building 32bit xen-tools on a amd64 machine, i.e.
"XEN_TARGET_ARCH=x86_32 make".

For ioemu I've taken the lazy path and just disabled them for
cross-builds, I'll leave that to fix to someone who knows the
qemu makefiles better than I do ;)

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
 config/x86_32.mk              |    6 ++++--
 tools/Makefile                |    2 +-
 tools/misc/mbootpack/Makefile |    4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

Index: build-32-unstable-11624/config/x86_32.mk
===================================================================
--- build-32-unstable-11624.orig/config/x86_32.mk
+++ build-32-unstable-11624/config/x86_32.mk
@@ -5,5 +5,7 @@ CONFIG_XCUTILS := y
 CONFIG_IOEMU := y
 CONFIG_MBOOTPACK := y
 
-CFLAGS += -m32 -march=i686
-LIBDIR := lib
+CFLAGS  += -m32 -march=i686
+LDFLAGS += -m32
+ASFLAGS += -m32
+LIBDIR  := lib
Index: build-32-unstable-11624/tools/misc/mbootpack/Makefile
===================================================================
--- build-32-unstable-11624.orig/tools/misc/mbootpack/Makefile
+++ build-32-unstable-11624/tools/misc/mbootpack/Makefile
@@ -35,7 +35,7 @@ DEPFLAGS = -Wp,-MD,.$(@F).d
 DEPS     = .*.d
 
 mbootpack: $(OBJS)
-	$(HOSTCC) -o $@ $(filter-out %.a, $^)
+	$(HOSTCC) $(CFLAGS) -o $@ $(filter-out %.a, $^)
 
 .PHONY: clean
 clean:
@@ -50,7 +50,7 @@ setup: setup.S
 	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@
 
 bin2c: bin2c.o 
-	$(HOSTCC) -o $@ $^ 
+	$(HOSTCC) $(CFLAGS) -o $@ $^
 
 bzimage_header.c: bootsect setup bin2c
 	./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c
Index: build-32-unstable-11624/tools/Makefile
===================================================================
--- build-32-unstable-11624.orig/tools/Makefile
+++ build-32-unstable-11624/tools/Makefile
@@ -60,7 +60,7 @@ check_clean:
 	$(MAKE) -C check clean
 
 .PHONY: ioemu ioemuinstall ioemuclean
-ifdef CONFIG_IOEMU
+ifeq ($(XEN_COMPILE_ARCH)$(CONFIG_IOEMU),$(XEN_TARGET_ARCH)y)
 export IOEMU_DIR ?= ioemu
 ioemu ioemuinstall:
 	[ -f $(IOEMU_DIR)/config-host.mak ] || \

--

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-05  8:48 kraxel
@ 2006-10-05  8:55 ` Keir Fraser
  2006-10-05  9:22   ` Gerd Hoffmann
  0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2006-10-05  8:55 UTC (permalink / raw)
  To: kraxel, xen-devel




On 5/10/06 9:48 am, "kraxel@suse.de" <kraxel@suse.de> wrote:

> This fixes building 32bit xen-tools on a amd64 machine, i.e.
> "XEN_TARGET_ARCH=x86_32 make".
> 
> For ioemu I've taken the lazy path and just disabled them for
> cross-builds, I'll leave that to fix to someone who knows the
> qemu makefiles better than I do ;)

The mbootpack change seems wrong. It's not installed on the target machine
(it's a build-system tool) so it should actually be built with HOSTCFLAGS,
not CFLAGS. Is that reasonable?

Presumably the most important part of this patch is the change to LDFLAGS
and ASFLAGS? I suppose any halfway modern version of binutils must support
those flags (otherwise gcc -m32 wouldn't work)?

 -- Keir

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-05  8:55 ` Keir Fraser
@ 2006-10-05  9:22   ` Gerd Hoffmann
  2006-10-05 10:40     ` Gerd Hoffmann
  2006-10-05 11:45     ` John Levon
  0 siblings, 2 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2006-10-05  9:22 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

Keir Fraser wrote:
> The mbootpack change seems wrong. It's not installed on the target machine
> (it's a build-system tool) so it should actually be built with HOSTCFLAGS,
> not CFLAGS. Is that reasonable?

For the x86_32 on x86_64 it works as-is, because the 32bit binaries work
on 64bit too.  Looking at it strictly it is indeed  not fully correct
though, HOSTCCFLAGS should be used instead.  But some more tweaks are
needed then, you'll have to take care that the object files are compiled
with HOSTCC (and HOSTCFLAGS) too (they are not at the moment).

> Presumably the most important part of this patch is the change to LDFLAGS
> and ASFLAGS?

Yes, that makes most bits compile fine, except qemu-dm.

> I suppose any halfway modern version of binutils must support
> those flags (otherwise gcc -m32 wouldn't work)?

Yes, gcc passes -m32 through to the linker.

cheers,

  Gerd

-- 
Gerd Hoffmann <kraxel@suse.de>
http://www.suse.de/~kraxel/julika-dora.jpeg

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-05  9:22   ` Gerd Hoffmann
@ 2006-10-05 10:40     ` Gerd Hoffmann
  2006-10-05 11:45     ` John Levon
  1 sibling, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2006-10-05 10:40 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: xen-devel

Gerd Hoffmann wrote:
> For the x86_32 on x86_64 it works as-is, because the 32bit binaries work
> on 64bit too.  Looking at it strictly it is indeed  not fully correct
> though, HOSTCCFLAGS should be used instead.  But some more tweaks are
> needed then, you'll have to take care that the object files are compiled
> with HOSTCC (and HOSTCFLAGS) too (they are not at the moment).

While playing with that: mbootpack.c doesn't even build with -m64, so
its probably best to simply stick with compiling 32bit binaries ...

cheers,
  Gerd

-- 
Gerd Hoffmann <kraxel@suse.de>
http://www.suse.de/~kraxel/julika-dora.jpeg

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-05  9:22   ` Gerd Hoffmann
  2006-10-05 10:40     ` Gerd Hoffmann
@ 2006-10-05 11:45     ` John Levon
  1 sibling, 0 replies; 10+ messages in thread
From: John Levon @ 2006-10-05 11:45 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: xen-devel

On Thu, Oct 05, 2006 at 11:22:12AM +0200, Gerd Hoffmann wrote:

> > I suppose any halfway modern version of binutils must support
> > those flags (otherwise gcc -m32 wouldn't work)?
> 
> Yes, gcc passes -m32 through to the linker.

This happens to work out OK on Solaris too: although the linker doesn't
understand -m32/-m64 (Solaris ld knows about "-64" only), our gcc
/does/, and we've explicitly set $(LD) to GNU ld.

regards
john

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

* [patch] Fix 32bit xen-tools build.
@ 2006-10-20  8:36 kraxel
  2006-10-20 12:25 ` John Levon
  0 siblings, 1 reply; 10+ messages in thread
From: kraxel @ 2006-10-20  8:36 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: cross-build-fix.diff --]
[-- Type: text/plain, Size: 1379 bytes --]

This fixes building 32bit xen-tools on a amd64 machine, i.e.
"XEN_TARGET_ARCH=x86_32 make".

For ioemu I've taken the lazy path and just disabled them for
cross-builds, I'll leave that to fix to someone who knows the
qemu makefiles better than I do ;)

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
 config/x86_32.mk |    6 ++++--
 tools/Makefile   |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

Index: build-32-unstable-11822/config/x86_32.mk
===================================================================
--- build-32-unstable-11822.orig/config/x86_32.mk
+++ build-32-unstable-11822/config/x86_32.mk
@@ -6,8 +6,10 @@ CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
 CONFIG_IOEMU := y
 
-CFLAGS += -m32 -march=i686
-LIBDIR := lib
+CFLAGS  += -m32 -march=i686
+LDFLAGS += -m32
+ASFLAGS += -m32
+LIBDIR  := lib
 
 # Use only if calling $(LD) directly.
 ifeq ($(XEN_OS),OpenBSD)
Index: build-32-unstable-11822/tools/Makefile
===================================================================
--- build-32-unstable-11822.orig/tools/Makefile
+++ build-32-unstable-11822/tools/Makefile
@@ -60,7 +60,7 @@ check_clean:
 	$(MAKE) -C check clean
 
 .PHONY: ioemu ioemuinstall ioemuclean
-ifeq ($(CONFIG_IOEMU),y)
+ifeq ($(XEN_COMPILE_ARCH)$(CONFIG_IOEMU),$(XEN_TARGET_ARCH)y)
 export IOEMU_DIR ?= ioemu
 ioemu ioemuinstall:
 	[ -f $(IOEMU_DIR)/config-host.mak ] || \

--

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-20  8:36 [patch] Fix 32bit xen-tools build kraxel
@ 2006-10-20 12:25 ` John Levon
  2006-10-21  7:43   ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: John Levon @ 2006-10-20 12:25 UTC (permalink / raw)
  To: kraxel; +Cc: xen-devel

On Fri, Oct 20, 2006 at 10:36:08AM +0200, kraxel@suse.de wrote:

> Index: build-32-unstable-11822/config/x86_32.mk
> ===================================================================
> --- build-32-unstable-11822.orig/config/x86_32.mk
> +++ build-32-unstable-11822/config/x86_32.mk
> @@ -6,8 +6,10 @@ CONFIG_MIGRATE := y
>  CONFIG_XCUTILS := y
>  CONFIG_IOEMU := y
>  
> -CFLAGS += -m32 -march=i686
> -LIBDIR := lib
> +CFLAGS  += -m32 -march=i686
> +LDFLAGS += -m32
> +ASFLAGS += -m32
> +LIBDIR  := lib

Where is left that needs LDFLAGS/ASFLAGS to have the -m flags? It's
wrong anyway, there should be nowhere that's not using $CFLAGS; see the
previous discussion. We've had to disable a couple of directories for
now, so probably it's in one of those?

regards
john

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-20 12:25 ` John Levon
@ 2006-10-21  7:43   ` Keir Fraser
  2006-10-23  7:35     ` Gerd Hoffmann
  0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2006-10-21  7:43 UTC (permalink / raw)
  To: John Levon, kraxel; +Cc: xen-devel

On 20/10/06 1:25 pm, "John Levon" <levon@movementarian.org> wrote:

>> -CFLAGS += -m32 -march=i686
>> -LIBDIR := lib
>> +CFLAGS  += -m32 -march=i686
>> +LDFLAGS += -m32
>> +ASFLAGS += -m32
>> +LIBDIR  := lib
> 
> Where is left that needs LDFLAGS/ASFLAGS to have the -m flags? It's
> wrong anyway, there should be nowhere that's not using $CFLAGS; see the
> previous discussion. We've had to disable a couple of directories for
> now, so probably it's in one of those?

Bit more context: anywhere that *is* using $(LD) directly should add
$(LDFLAGS_DIRECT) to the command line. This adds -mi386 or -mx86_64. The
linker does not understand -m32/-m64. But anywhere not doing tricky links
(e.g., with a GNU-specific script) should call the linker via the GCC
driver.

 -- Keir

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-21  7:43   ` Keir Fraser
@ 2006-10-23  7:35     ` Gerd Hoffmann
  2006-10-23  8:51       ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: Gerd Hoffmann @ 2006-10-23  7:35 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, John Levon

Keir Fraser wrote:
> On 20/10/06 1:25 pm, "John Levon" <levon@movementarian.org> wrote:
> 
>> Where is left that needs LDFLAGS/ASFLAGS to have the -m flags? It's
>> wrong anyway, there should be nowhere that's not using $CFLAGS; see the
>> previous discussion. We've had to disable a couple of directories for
>> now, so probably it's in one of those?
> 
> Bit more context: anywhere that *is* using $(LD) directly should add
> $(LDFLAGS_DIRECT) to the command line. This adds -mi386 or -mx86_64. The
> linker does not understand -m32/-m64. But anywhere not doing tricky links
> (e.g., with a GNU-specific script) should call the linker via the GCC
> driver.

Rechecked, seems to be fixed now, except for qemu-dm which still doesn't
build when compiling 32bit tools on a 64bit machine ...

cheers,
  Gerd

-- 
Gerd Hoffmann <kraxel@suse.de>
http://www.suse.de/~kraxel/julika-dora.jpeg

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

* Re: [patch] Fix 32bit xen-tools build.
  2006-10-23  7:35     ` Gerd Hoffmann
@ 2006-10-23  8:51       ` Keir Fraser
  0 siblings, 0 replies; 10+ messages in thread
From: Keir Fraser @ 2006-10-23  8:51 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: xen-devel, John Levon




On 23/10/06 08:35, "Gerd Hoffmann" <kraxel@suse.de> wrote:

>> Bit more context: anywhere that *is* using $(LD) directly should add
>> $(LDFLAGS_DIRECT) to the command line. This adds -mi386 or -mx86_64. The
>> linker does not understand -m32/-m64. But anywhere not doing tricky links
>> (e.g., with a GNU-specific script) should call the linker via the GCC
>> driver.
> 
> Rechecked, seems to be fixed now, except for qemu-dm which still doesn't
> build when compiling 32bit tools on a 64bit machine ...

It has its own configuration system which may need patching. It basically
doesn't use the Config.mk/Rules.mk definitions that everyone else does.

 -- Keir

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

end of thread, other threads:[~2006-10-23  8:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20  8:36 [patch] Fix 32bit xen-tools build kraxel
2006-10-20 12:25 ` John Levon
2006-10-21  7:43   ` Keir Fraser
2006-10-23  7:35     ` Gerd Hoffmann
2006-10-23  8:51       ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2006-10-05  8:48 kraxel
2006-10-05  8:55 ` Keir Fraser
2006-10-05  9:22   ` Gerd Hoffmann
2006-10-05 10:40     ` Gerd Hoffmann
2006-10-05 11:45     ` 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.