Commit f05b1c0b authored by Paolo \'Blaisorblade\' Giarrusso's avatar Paolo \'Blaisorblade\' Giarrusso Committed by Linus Torvalds

[PATCH] uml: Single Linking Step for vmlinux

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: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a2b9d5ab
...@@ -22,13 +22,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ ...@@ -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 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_TT) += Makefile-tt
MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas
...@@ -66,18 +59,14 @@ ifeq ($(CONFIG_MODE_SKAS), y) ...@@ -66,18 +59,14 @@ ifeq ($(CONFIG_MODE_SKAS), y)
$(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h $(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
endif endif
$(ARCH_DIR)/vmlinux.lds.S : prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
touch $@ $(ARCH_DIR)/kernel/vmlinux.lds.S
prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
LDFLAGS_vmlinux = -r
# These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT + # These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT +
# CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case. # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
LINK_TT = -static LINK_TT = -static
LD_SCRIPT_TT := uml.lds LD_SCRIPT_TT := uml.lds.S
ifeq ($(CONFIG_STATIC_LINK),y) ifeq ($(CONFIG_STATIC_LINK),y)
LINK-y += $(LINK_TT) LINK-y += $(LINK_TT)
...@@ -94,6 +83,12 @@ endif ...@@ -94,6 +83,12 @@ endif
endif 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) CPP_MODE_TT := $(shell [ "$(CONFIG_MODE_TT)" = "y" ] && echo -DMODE_TT)
CONFIG_KERNEL_STACK_ORDER ?= 2 CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
...@@ -107,13 +102,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ ...@@ -107,13 +102,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
-DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \
-DKERNEL_STACK_SIZE=$(STACK_SIZE)) -DKERNEL_STACK_SIZE=$(STACK_SIZE))
export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum CFLAGS_vmlinux = $(LINK-y) $(LINK_WRAPS)
define cmd_vmlinux__
LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y) $(CC) $(CFLAGS_vmlinux) -o $@ \
-Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
linux: vmlinux $(LD_SCRIPT-y) -Wl,--start-group $(vmlinux-main) -Wl,--end-group \
$(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \ -L/usr/lib -lutil \
-o linux vmlinux -L/usr/lib -lutil $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
endef
USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS)) USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
...@@ -168,15 +164,9 @@ $(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants ...@@ -168,15 +164,9 @@ $(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants
$(call filechk,gen_header) $(call filechk,gen_header)
$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants : $(ARCH_DIR)/util \ $(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)=$@ $(Q)$(MAKE) $(build)=$@
export SUBARCH USER_CFLAGS OS export SUBARCH USER_CFLAGS OS
all: linux
define archhelp
echo '* linux - Binary kernel image (./linux)'
endef
...@@ -26,8 +26,6 @@ SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util ...@@ -26,8 +26,6 @@ SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
sys_prepare: $(SYS_DIR)/sc.h
prepare: $(SYS_HEADERS) prepare: $(SYS_HEADERS)
filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc
...@@ -40,10 +38,10 @@ filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread ...@@ -40,10 +38,10 @@ filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread
$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$(call filechk,$@) $(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) $@ $(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) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR): include/asm FORCE $(SYS_UTIL_DIR): include/asm FORCE
......
...@@ -12,7 +12,7 @@ LINK-$(CONFIG_GPROF) += $(PROFILE) ...@@ -12,7 +12,7 @@ LINK-$(CONFIG_GPROF) += $(PROFILE)
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include
LINK_SKAS = -Wl,-rpath,/lib 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 GEN_HEADERS += $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
......
#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"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment