[PATCH] uml: start cross-build support : mk_user_constants

Beginning of cross-build fixes.  Instead of expecting that mk_user_constants
(compiled and executed on the build box) will see the sizeof, etc.  for target
box, we do what every architecture already does for asm-offsets.  Namely, have
user-offsets.c compiled *for* *target* into user-offsets.s and sed it into the
header with relevant constants.  We don't need to reinvent any wheels - all
tools are already there.

This patch deals with mk_user_constants.  It doesn't assume any relationship
between target and build environment anymore - we pick all defines we need
from user-offsets.h.  Later patches will deal with the rest of mk_...  helpers
in the same way.

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Al Viro
2005-05-05 16:15:23 -07:00
committed by Linus Torvalds
parent fcddd72e3e
commit 8d0b9dc9be
5 changed files with 158 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
hostprogs-y := mk_user_constants
always := $(hostprogs-y)
mk_user_constants-objs := mk_user_constants.o
HOSTCFLAGS_mk_user_constants.o := -I$(objtree)/arch/um

View File

@@ -1,11 +1,5 @@
#include <stdio.h>
#include <asm/types.h>
/* For some reason, x86_64 nowhere defines u64 and u32, even though they're
* used throughout the headers.
*/
typedef __u64 u64;
typedef __u32 u32;
#include <asm/user.h>
#include <user-offsets.h>
int main(int argc, char **argv)
{
@@ -20,7 +14,7 @@ int main(int argc, char **argv)
* x86_64 (216 vs 168 bytes). user_regs_struct is the correct size on
* both x86_64 and i386.
*/
printf("#define UM_FRAME_SIZE %d\n", (int) sizeof(struct user_regs_struct));
printf("#define UM_FRAME_SIZE %d\n", __UM_FRAME_SIZE);
printf("\n");
printf("#endif\n");