]> git.hungrycats.org Git - linux/commitdiff
[PATCH] uml: Single Linking Step for vmlinux
authorPaolo \'Blaisorblade\' Giarrusso <blaisorblade_spam@yahoo.it>
Wed, 13 Oct 2004 14:30:10 +0000 (07:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 13 Oct 2004 14:30:10 +0000 (07:30 -0700)
Uml-specific patch (which requires a mainline hook, mailed separately).

This patch avoid the linking kludge which leaves kbuild link vmlinux and then
link it with libc inside linux.  This kludge has the big problem of making
kallsyms break, since the kallsyms pass is done on a completely

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/Makefile
arch/um/Makefile-i386
arch/um/Makefile-skas
arch/um/kernel/vmlinux.lds.S [deleted file]

index a7f5e94b349d895454ea12979406d06305276566..1a26e5c959a38af711c7c3a839d071e99e46f0f7 100644 (file)
@@ -22,13 +22,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \
 
 GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h
 
-# This target adds dependencies to "prepare". They are defined in the included
-# Makefiles (see Makefile-i386).
-
-.PHONY: sys_prepare
-sys_prepare:
-       @:
-
 MAKEFILE-$(CONFIG_MODE_TT) += Makefile-tt
 MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas
 
@@ -66,18 +59,14 @@ ifeq ($(CONFIG_MODE_SKAS), y)
 $(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
 endif
 
-$(ARCH_DIR)/vmlinux.lds.S :
-       touch $@
-
-prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
-
-LDFLAGS_vmlinux = -r
+prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
+       $(ARCH_DIR)/kernel/vmlinux.lds.S
 
 # These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT +
 # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
 
 LINK_TT = -static
-LD_SCRIPT_TT := uml.lds
+LD_SCRIPT_TT := uml.lds.S
 
 ifeq ($(CONFIG_STATIC_LINK),y)
   LINK-y += $(LINK_TT)
@@ -94,6 +83,12 @@ endif
 endif
 endif
 
+#We need to re-preprocess this when the symlink dest changes.
+#So we just touch it.
+$(ARCH_DIR)/kernel/vmlinux.lds.S:
+       ln -sf $(LD_SCRIPT-y) $@
+       touch $@
+
 CPP_MODE_TT := $(shell [ "$(CONFIG_MODE_TT)" = "y" ] && echo -DMODE_TT)
 CONFIG_KERNEL_STACK_ORDER ?= 2
 STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
@@ -107,13 +102,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
        -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \
        -DKERNEL_STACK_SIZE=$(STACK_SIZE))
 
-export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum
-
-LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y)
-
-linux: vmlinux $(LD_SCRIPT-y)
-       $(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \
-               -o linux vmlinux -L/usr/lib -lutil
+CFLAGS_vmlinux = $(LINK-y) $(LINK_WRAPS)
+define cmd_vmlinux__
+       $(CC) $(CFLAGS_vmlinux) -o $@ \
+       -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
+       -Wl,--start-group $(vmlinux-main) -Wl,--end-group \
+       -L/usr/lib -lutil \
+       $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
+endef
 
 USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
 USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
@@ -168,15 +164,9 @@ $(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants
        $(call filechk,gen_header)
 
 $(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants : $(ARCH_DIR)/util \
-       sys_prepare FORCE ;
+       FORCE ;
 
-$(ARCH_DIR)/util: FORCE
+$(ARCH_DIR)/util: $(SYS_DIR)/sc.h FORCE
        $(Q)$(MAKE) $(build)=$@
 
 export SUBARCH USER_CFLAGS OS
-
-all: linux
-
-define archhelp
-  echo  '* linux       - Binary kernel image (./linux)'
-endef
index 0c3af647baa53cf3900e05b7397d9c3dbaaa1693..8bf654dbbb070ffa97927f910da2fea27a6d3bb7 100644 (file)
@@ -26,8 +26,6 @@ SYS_UTIL_DIR  := $(ARCH_DIR)/sys-i386/util
 
 SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
 
-sys_prepare: $(SYS_DIR)/sc.h
-
 prepare: $(SYS_HEADERS)
 
 filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc
@@ -40,10 +38,10 @@ filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread
 $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread 
        $(call filechk,$@)
 
-$(SYS_UTIL_DIR)/mk_sc: scripts/basic/fixdep include/config/MARKER FORCE ;
+$(SYS_UTIL_DIR)/mk_sc: scripts/basic/fixdep include/config/MARKER FORCE
        $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
 
-$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) sys_prepare FORCE ;
+$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE
        $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
 
 $(SYS_UTIL_DIR): include/asm FORCE
index b505e16c400124528ee77a93968194cc209f44ec..32bf54abd002fc7d79be8e9ca993e74acec508b9 100644 (file)
@@ -12,7 +12,7 @@ LINK-$(CONFIG_GPROF) += $(PROFILE)
 MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include
 
 LINK_SKAS = -Wl,-rpath,/lib 
-LD_SCRIPT_SKAS = dyn.lds
+LD_SCRIPT_SKAS = dyn.lds.S
 
 GEN_HEADERS += $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
 
diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
deleted file mode 100644 (file)
index db0445e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <asm-generic/vmlinux.lds.h>
-       
-OUTPUT_FORMAT(ELF_FORMAT)
-OUTPUT_ARCH(ELF_ARCH)
-ENTRY(_start)
-jiffies = jiffies_64;
-
-SECTIONS
-{
-#include "asm/common.lds.S"
-}