UML - Start cross-build support : mk_user_constants
PATCH 3/22 UML - Start cross-build support : mk_user_constants
Quoted 1 line
From Al Viro:
Beginning of cross-build fixes. Instead of expecting thatmk_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.
arch/um/Makefile +8 -0
@@ -166,6 +166,14 @@ $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h $(call filechk,umlconfig) +$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c + $(CC) $(USER_CFLAGS) -S -o $@ $< + +$(ARCH_DIR)/user-offsets.h: $(ARCH_DIR)/user-offsets.s + $(call filechk,gen-asm-offsets) + +CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/user-offsets.h + $(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task $(call filechk,gen_header)
arch/um/os-Linux/util/Makefile +1 -1
@@ -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
arch/um/os-Linux/util/mk_user_constants.c +2 -8
@@ -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 @@* 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" );
arch/um/sys-i386/user-offsets.c +69 -0
69 lines not on this page · raw message
arch/um/sys-x86_64/user-offsets.c +78 -0
78 lines not on this page · raw message