* [uml-devel] Supporting building on x86-64 host as 32-bit UML
@ 2005-03-19 18:04 Blaisorblade
2005-03-20 15:03 ` [uml-devel] " Gerd Knorr
0 siblings, 1 reply; 5+ messages in thread
From: Blaisorblade @ 2005-03-19 18:04 UTC (permalink / raw)
To: user-mode-linux-devel, Gerd Knorr
[-- Attachment #1: Type: text/plain, Size: 1839 bytes --]
It is really difficult for the end-user (and tricky for a developer) to build
a 32-bit UML on a 64-bit host box...
I would like to address this, but I've not definite ideas.
The problems are:
1) how the user must choose what he wants (SUBARCH=i386 can be useful, maybe a
Kconfig option would be nice - we need to choose the default depending on the
host arch).
2) using the proper options for the tools (addressed partially by the patch
below)
3) using the proper headers (asm-i386 instead of asm-x86_64)... Fedora (I
don't know about SuSE and my Gentoo is 32-bit still) uses some smart headers
that select the correct version, basing on some macros defined by GCC:
#ifndef __ASM_STUB_SYSTEM_H__
# define __ASM_STUB_SYSTEM_H__
# if defined __x86_64__
# include <asm-x86_64/system.h>
# endif
# if defined __i386__
# include <asm-i386/system.h>
# endif
#endif
The problem is that we explicitly refuse to define these macros, like this:
CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)
(from arch/um/Makefile-i386) for which I don't find a valid reason... I first
thought this was
diff -puN arch/um/Makefile~uml-build-on-x86_64_as_i386 arch/um/Makefile
--- linux-2.6.9-current/arch/um/Makefile~uml-build-on-x86_64_as_i386
2004-09-26 19:51:43.000000000 +0200
+++ linux-2.6.9-current-paolo/arch/um/Makefile 2004-09-26 19:59:17.000000000
+0200
@@ -34,6 +34,13 @@ endif
ARCH_INCLUDE := -I$(ARCH_DIR)/include
SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
+AFLAGS += -m32
+CFLAGS += -m32
+LDFLAGS += -melf_i386
+HOSTCFLAGS += -m32
+HOSTLDFLAGS += -m32
+export HOSTLDFLAGS
+
include $(ARCH_DIR)/Makefile-$(SUBARCH)
include $(ARCH_DIR)/Makefile-os-$(OS)
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
[-- Attachment #2: uml-build-on-x86_64_as_i386.patch --]
[-- Type: text/x-diff, Size: 758 bytes --]
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---
linux-2.6.9-current-paolo/arch/um/Makefile | 7 +++++++
1 files changed, 7 insertions(+)
diff -puN arch/um/Makefile~uml-build-on-x86_64_as_i386 arch/um/Makefile
--- linux-2.6.9-current/arch/um/Makefile~uml-build-on-x86_64_as_i386 2004-09-26 19:51:43.000000000 +0200
+++ linux-2.6.9-current-paolo/arch/um/Makefile 2004-09-26 19:59:17.000000000 +0200
@@ -34,6 +34,13 @@ endif
ARCH_INCLUDE := -I$(ARCH_DIR)/include
SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
+AFLAGS += -m32
+CFLAGS += -m32
+LDFLAGS += -melf_i386
+HOSTCFLAGS += -m32
+HOSTLDFLAGS += -m32
+export HOSTLDFLAGS
+
include $(ARCH_DIR)/Makefile-$(SUBARCH)
include $(ARCH_DIR)/Makefile-os-$(OS)
_
^ permalink raw reply [flat|nested] 5+ messages in thread
* [uml-devel] Re: Supporting building on x86-64 host as 32-bit UML
2005-03-19 18:04 [uml-devel] Supporting building on x86-64 host as 32-bit UML Blaisorblade
@ 2005-03-20 15:03 ` Gerd Knorr
2005-03-22 17:53 ` Blaisorblade
0 siblings, 1 reply; 5+ messages in thread
From: Gerd Knorr @ 2005-03-20 15:03 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
> 1) how the user must choose what he wants (SUBARCH=i386 can be useful,
> maybe a Kconfig option would be nice - we need to choose the default
> depending on the host arch).
That one is easy -- just use "linux32 make ...". That will switch the
personality and "uname" will return "i686" instead of "x86_64" then ;)
> 2) using the proper options for the tools (addressed partially by the
> patch below)
Probably still needed. Maybe not any more with gcc4, I remember there
was some discussion among the gcc folks to make gcc default to -m64 /
-m32 depending on the current personalily. In that case the linux32
thingy mentioned above should catch that one as well. Not sure that
actually happened.
> 3) using the proper headers (asm-i386 instead of asm-x86_64)... Fedora
linux32 should fix that one as well.
> +AFLAGS += -m32
> +CFLAGS += -m32
I think that can also be fixed on the make command line, with a small
wrapper script -- named make32 for example -- doing something like this:
#!/bin/sh
exec linux32 make CC="gcc -m32" AS="as -m32" ... "$@"
Last time I tried I ran into the problem that the glibc headers of the
x86_64 biarch compiler slightly different from the ones on a real i386
machine, thus some #ifdefs in uml userspace code didn't work as expected
and broke the build.
> +HOSTCFLAGS += -m32
> +HOSTLDFLAGS += -m32
Not needed I think. Thats used for kconfig and other stuff which runs
on the _host_ machine (for cross compiles), thus it doesn't hurt if it
is 64 bit.
Gerd
--
#define printk(args...) fprintf(stderr, ## args)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [uml-devel] Re: Supporting building on x86-64 host as 32-bit UML
2005-03-20 15:03 ` [uml-devel] " Gerd Knorr
@ 2005-03-22 17:53 ` Blaisorblade
2005-03-22 19:07 ` Gerd Knorr
0 siblings, 1 reply; 5+ messages in thread
From: Blaisorblade @ 2005-03-22 17:53 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Gerd Knorr
On Sunday 20 March 2005 16:03, Gerd Knorr wrote:
> > 1) how the user must choose what he wants (SUBARCH=i386 can be useful,
> > maybe a Kconfig option would be nice - we need to choose the default
> > depending on the host arch).
>
> That one is easy -- just use "linux32 make ...". That will switch the
> personality and "uname" will return "i686" instead of "x86_64" then ;)
linux32 is a SuSE specific alias like the "i386" for Fedora, right (they both
alias setarch, IIRC)?
> > 2) using the proper options for the tools (addressed partially by the
> > patch below)
>
> Probably still needed. Maybe not any more with gcc4, I remember there
> was some discussion among the gcc folks to make gcc default to -m64 /
> -m32 depending on the current personalily. In that case the linux32
> thingy mentioned above should catch that one as well. Not sure that
> actually happened.
We're not going to wait gcc4, especially if it is still so memory hungry...
> > 3) using the proper headers (asm-i386 instead of asm-x86_64)... Fedora
>
> linux32 should fix that one as well.
>
> > +AFLAGS += -m32
> > +CFLAGS += -m32
>
> I think that can also be fixed on the make command line, with a small
> wrapper script -- named make32 for example -- doing something like this:
>
> #!/bin/sh
> exec linux32 make CC="gcc -m32" AS="as -m32" ... "$@"
>
> Last time I tried I ran into the problem that the glibc headers of the
> x86_64 biarch compiler slightly different from the ones on a real i386
> machine, thus some #ifdefs in uml userspace code didn't work as expected
> and broke the build.
>
> > +HOSTCFLAGS += -m32
> > +HOSTLDFLAGS += -m32
>
> Not needed I think. Thats used for kconfig and other stuff which runs
> on the _host_ machine (for cross compiles), thus it doesn't hurt if it
> is 64 bit.
I'm not sure, but that's probably needed for the userspace utilities that
print out some headers (with offsets inside host proc. specific structs).
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [uml-devel] Re: Supporting building on x86-64 host as 32-bit UML
2005-03-22 17:53 ` Blaisorblade
@ 2005-03-22 19:07 ` Gerd Knorr
2005-03-22 20:02 ` Blaisorblade
0 siblings, 1 reply; 5+ messages in thread
From: Gerd Knorr @ 2005-03-22 19:07 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
On Tue, Mar 22, 2005 at 06:53:20PM +0100, Blaisorblade wrote:
> On Sunday 20 March 2005 16:03, Gerd Knorr wrote:
> > > 1) how the user must choose what he wants (SUBARCH=i386 can be useful,
> > > maybe a Kconfig option would be nice - we need to choose the default
> > > depending on the host arch).
> >
> > That one is easy -- just use "linux32 make ...". That will switch the
> > personality and "uname" will return "i686" instead of "x86_64" then ;)
> linux32 is a SuSE specific alias like the "i386" for Fedora, right (they both
> alias setarch, IIRC)?
Don't have a "setarch" binary here. But most likely they do almost the
same, yes.
> > Not needed I think. Thats used for kconfig and other stuff which runs
> > on the _host_ machine (for cross compiles), thus it doesn't hurt if it
> > is 64 bit.
> I'm not sure, but that's probably needed for the userspace utilities that
> print out some headers (with offsets inside host proc. specific structs).
Uhm, ok, then it probably is needed. This also means that you can't
cross-compile uml kernels, right?
Gerd
--
#define printk(args...) fprintf(stderr, ## args)
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [uml-devel] Re: Supporting building on x86-64 host as 32-bit UML
2005-03-22 19:07 ` Gerd Knorr
@ 2005-03-22 20:02 ` Blaisorblade
0 siblings, 0 replies; 5+ messages in thread
From: Blaisorblade @ 2005-03-22 20:02 UTC (permalink / raw)
To: Gerd Knorr; +Cc: user-mode-linux-devel
On Tuesday 22 March 2005 20:07, Gerd Knorr wrote:
> On Tue, Mar 22, 2005 at 06:53:20PM +0100, Blaisorblade wrote:
> > On Sunday 20 March 2005 16:03, Gerd Knorr wrote:
> > > > 1) how the user must choose what he wants (SUBARCH=i386 can be
> > > > useful, maybe a Kconfig option would be nice - we need to choose the
> > > > default depending on the host arch).
> > >
> > > That one is easy -- just use "linux32 make ...". That will switch the
> > > personality and "uname" will return "i686" instead of "x86_64" then ;)
> >
> > linux32 is a SuSE specific alias like the "i386" for Fedora, right (they
> > both alias setarch, IIRC)?
>
> Don't have a "setarch" binary here. But most likely they do almost the
> same, yes.
>
> > > Not needed I think. Thats used for kconfig and other stuff which runs
> > > on the _host_ machine (for cross compiles), thus it doesn't hurt if it
> > > is 64 bit.
> >
> > I'm not sure, but that's probably needed for the userspace utilities that
> > print out some headers (with offsets inside host proc. specific structs).
>
> Uhm, ok, then it probably is needed. This also means that you can't
> cross-compile uml kernels, right?
Eh? Those utilities must run on the compile host, and they are compiled with
HOSTCC, but use the targets header. So on x86-64 / x86 it works, but probably
in general you are right (I don't have the whole picture right now, but this
makes sense).
That said, Al Viro changed this significantly when working on making UML
cross-compile well, so you again are probably right. I'm currently merging
his work in little pieces.
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-22 20:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 18:04 [uml-devel] Supporting building on x86-64 host as 32-bit UML Blaisorblade
2005-03-20 15:03 ` [uml-devel] " Gerd Knorr
2005-03-22 17:53 ` Blaisorblade
2005-03-22 19:07 ` Gerd Knorr
2005-03-22 20:02 ` Blaisorblade
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.