Commit 5b0f6ac4 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Move generation of vmlinux.lds.s into arch/.../kernel

Currently, vmlinux.lds.s is generated by the top-level Makefile.
Unfortunately, this causes the automatic CONFIG dependencies to
not work correctly, the reason being that make caches the timestamps
of include/config/* so even after split-include updated the
timestamps, make still uses the cached stamps to decide whether to
rebuild vmlinux.lds.s.

The simple fix is to move generation of vmlinux.lds.s into the
arch/$(ARCH)/kernel subdirectories, where we build other files
for the final link (like head.o) anyway. This also means some
special code in the top-level Makefile for preprocessing can go
away, since we now just use the standard rules during the recursive
phase.

This patches fixes up all archs for this change (untested).
parent 21fbda93
......@@ -388,7 +388,7 @@ define rule_vmlinux
$(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
# Generate section listing all symbols and add it into vmlinux
# It's a three stage process:
......@@ -414,23 +414,23 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@
.tmp_kallsyms%.S: .tmp_vmlinux%
$(call cmd,kallsyms)
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
+$(call if_changed_rule,vmlinux__)
.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE
.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
$(call if_changed_rule,vmlinux__)
endif
# Finally the vmlinux rule
vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/vmlinux.lds.s FORCE
vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
$(call if_changed_rule,vmlinux)
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
$(sort $(vmlinux-objs)): $(SUBDIRS) ;
$(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(SUBDIRS) ;
# Handle descending into subdirectories listed in $(SUBDIRS)
......@@ -453,15 +453,10 @@ endif
endif
$(if $(CONFIG_MODULES),$(Q)mkdir -p $(MODVERDIR))
# This can be used by arch/$ARCH/Makefile to preprocess
# their vmlinux.lds.S file
# Leave this as default for preprocessing vmlinux.lds.S, which is now
# done in arch/$(ARCH)/kernel/Makefile
AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE
$(call if_changed_dep,as_s_S)
targets += arch/$(ARCH)/vmlinux.lds.s
export AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
# Single targets
# ---------------------------------------------------------------------------
......@@ -882,9 +877,6 @@ endif # ifdef include_config
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
quiet_cmd_as_o_S = AS $@
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
......
......@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
extra-y := head.o
extra-y := head.o vmlinux.lds.s
EXTRA_AFLAGS := $(CFLAGS)
EXTRA_CFLAGS := -Werror -Wno-sign-compare
......
......@@ -30,7 +30,7 @@ endif
head-y := head.o
obj-$(CONFIG_DEBUG_LL) += debug.o
extra-y := $(head-y) init_task.o
extra-y := $(head-y) init_task.o vmlinux.lds.s
# Spell out some dependencies that `make dep' doesn't spot
$(obj)/entry-armv.o: $(obj)/entry-header.S include/asm-arm/constants.h
......
......@@ -14,5 +14,5 @@ obj-y := compat.o dma.o entry.o irq.o \
obj-$(CONFIG_FIQ) += fiq.o
obj-$(CONFIG_MODULES) += armksyms.o
extra-y := init_task.o
extra-y := init_task.o vmlinux.lds.s
......@@ -93,7 +93,7 @@ arch/$(ARCH)/.links:
@ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers
@ln -sfn $(SARCH)/boot arch/$(ARCH)/boot
@ln -sfn $(SARCH)/lib arch/$(ARCH)/lib
@ln -sfn $(SARCH)/vmlinux.lds.S arch/$(ARCH)/vmlinux.lds.S
@ln -sfn $(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S
@touch $@
# Create link to sub arch includes
......
......@@ -3,6 +3,8 @@
# Makefile for the linux kernel.
#
extra-y := vmlinux.lds.s
obj-y := process.o traps.o irq.o ptrace.o setup.o \
time.o sys_cris.o semaphore.o
......
#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
extra-y := vmlinux.lds.s
obj-y := process.o traps.o ptrace.o \
sys_h8300.o time.o semaphore.o signal.o \
......
......@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
......
......@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \
irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \
......
......@@ -7,6 +7,7 @@ ifndef CONFIG_SUN3
else
extra-y := sun3-head.o
endif
extra-y += vmlinux.lds.s
obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \
sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
......
......@@ -2,6 +2,8 @@
# Makefile for arch/m68knommu/kernel.
#
extra-y := vmlinux.lds.s
obj-y += entry.o init_task.o m68k_ksyms.o process.o ptrace.o \
semaphore.o setup.o signal.o syscalltable.o sys_m68k.o time.o \
traps.o
......
......@@ -2,7 +2,7 @@
# Makefile for the Linux/MIPS kernel.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
......
......@@ -4,7 +4,7 @@
head-y := head.o
head-$(CONFIG_PARISC64) := head64.o
extra-y := init_task.o $(head-y)
extra-y := init_task.o $(head-y) vmlinux.lds.s
AFLAGS_entry.o := -traditional
AFLAGS_pacache.o := -traditional
......
......@@ -14,6 +14,7 @@ extra-y := head.o
extra-$(CONFIG_40x) := head_4xx.o
extra-$(CONFIG_8xx) := head_8xx.o
extra-$(CONFIG_6xx) += idle_6xx.o
extra-y += vmlinux.lds.s
obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
process.o signal.o ptrace.o align.o \
......
......@@ -3,7 +3,8 @@
#
EXTRA_CFLAGS += -mno-minimal-toc
extra-y := head.o
extra-y := head.o vmlinux.lds.s
obj-y := setup.o entry.o traps.o irq.o idle.o \
time.o process.o signal.o syscalls.o misc.o ptrace.o \
align.o semaphore.o bitops.o stab.o htab.o pacaData.o \
......
......@@ -10,7 +10,7 @@ obj-y := bitmap.o traps.o time.o process.o \
extra-$(CONFIG_ARCH_S390_31) += head.o
extra-$(CONFIG_ARCH_S390X) += head64.o
extra-y += init_task.o
extra-y += init_task.o vmlinux.lds.s
obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
obj-$(CONFIG_SMP) += smp.o
......
......@@ -2,7 +2,7 @@
# Makefile for the Linux/SuperH kernel.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o setup.o time.o sys_sh.o semaphore.o \
......
......@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
EXTRA_AFLAGS := -ansi
......
......@@ -5,7 +5,7 @@
EXTRA_AFLAGS := -ansi
EXTRA_CFLAGS := -Werror
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y := process.o setup.o cpu.o idprom.o \
traps.o devices.o auxio.o \
......
......@@ -3,6 +3,8 @@
# Licensed under the GPL
#
extra-y := vmlinux.lds.s
obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o \
process.o process_kern.o ptrace.o reboot.o resource.o sigio_user.o \
......
......@@ -9,7 +9,7 @@
# for more details.
#
extra-y := head.o init_task.o
extra-y := head.o init_task.o vmlinux.lds.s
obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \
signal.o irq.o mach.o ptrace.o bug.o
......
......@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
extra-y := head.o head64.o init_task.o
extra-y := head.o head64.o init_task.o vmlinux.lds.s
EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
......
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