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 ...@@ -388,7 +388,7 @@ define rule_vmlinux
$(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef 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 # Generate section listing all symbols and add it into vmlinux
# It's a three stage process: # It's a three stage process:
...@@ -414,23 +414,23 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@ ...@@ -414,23 +414,23 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@
.tmp_kallsyms%.S: .tmp_vmlinux% .tmp_kallsyms%.S: .tmp_vmlinux%
$(call cmd,kallsyms) $(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__) +$(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__) $(call if_changed_rule,vmlinux__)
endif endif
# Finally the vmlinux rule # 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) $(call if_changed_rule,vmlinux)
# The actual objects are generated when descending, # The actual objects are generated when descending,
# make sure no implicit rule kicks in # 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) # Handle descending into subdirectories listed in $(SUBDIRS)
...@@ -453,15 +453,10 @@ endif ...@@ -453,15 +453,10 @@ endif
endif endif
$(if $(CONFIG_MODULES),$(Q)mkdir -p $(MODVERDIR)) $(if $(CONFIG_MODULES),$(Q)mkdir -p $(MODVERDIR))
# This can be used by arch/$ARCH/Makefile to preprocess # Leave this as default for preprocessing vmlinux.lds.S, which is now
# their vmlinux.lds.S file # done in arch/$(ARCH)/kernel/Makefile
AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH) export 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
# Single targets # Single targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -882,9 +877,6 @@ endif # ifdef include_config ...@@ -882,9 +877,6 @@ endif # ifdef include_config
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) $(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 $@ quiet_cmd_as_o_S = AS $@
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := head.o extra-y := head.o vmlinux.lds.s
EXTRA_AFLAGS := $(CFLAGS) EXTRA_AFLAGS := $(CFLAGS)
EXTRA_CFLAGS := -Werror -Wno-sign-compare EXTRA_CFLAGS := -Werror -Wno-sign-compare
......
...@@ -30,7 +30,7 @@ endif ...@@ -30,7 +30,7 @@ endif
head-y := head.o head-y := head.o
obj-$(CONFIG_DEBUG_LL) += debug.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 # Spell out some dependencies that `make dep' doesn't spot
$(obj)/entry-armv.o: $(obj)/entry-header.S include/asm-arm/constants.h $(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 \ ...@@ -14,5 +14,5 @@ obj-y := compat.o dma.o entry.o irq.o \
obj-$(CONFIG_FIQ) += fiq.o obj-$(CONFIG_FIQ) += fiq.o
obj-$(CONFIG_MODULES) += armksyms.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: ...@@ -93,7 +93,7 @@ arch/$(ARCH)/.links:
@ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers @ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers
@ln -sfn $(SARCH)/boot arch/$(ARCH)/boot @ln -sfn $(SARCH)/boot arch/$(ARCH)/boot
@ln -sfn $(SARCH)/lib arch/$(ARCH)/lib @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 $@ @touch $@
# Create link to sub arch includes # Create link to sub arch includes
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
extra-y := vmlinux.lds.s
obj-y := process.o traps.o irq.o ptrace.o setup.o \ obj-y := process.o traps.o irq.o ptrace.o setup.o \
time.o sys_cris.o semaphore.o time.o sys_cris.o semaphore.o
......
# #
# Makefile for the linux kernel. # 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 extra-y := vmlinux.lds.s
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
obj-y := process.o traps.o ptrace.o \ obj-y := process.o traps.o ptrace.o \
sys_h8300.o time.o semaphore.o signal.o \ sys_h8300.o time.o semaphore.o signal.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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 \ 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 \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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 \ 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 \ 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 ...@@ -7,6 +7,7 @@ ifndef CONFIG_SUN3
else else
extra-y := sun3-head.o extra-y := sun3-head.o
endif endif
extra-y += vmlinux.lds.s
obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ 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 sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Makefile for arch/m68knommu/kernel. # Makefile for arch/m68knommu/kernel.
# #
extra-y := vmlinux.lds.s
obj-y += entry.o init_task.o m68k_ksyms.o process.o ptrace.o \ 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 \ semaphore.o setup.o signal.o syscalltable.o sys_m68k.o time.o \
traps.o traps.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the Linux/MIPS kernel. # 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 \ 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 \ ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
head-y := head.o head-y := head.o
head-$(CONFIG_PARISC64) := head64.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_entry.o := -traditional
AFLAGS_pacache.o := -traditional AFLAGS_pacache.o := -traditional
......
...@@ -14,6 +14,7 @@ extra-y := head.o ...@@ -14,6 +14,7 @@ extra-y := head.o
extra-$(CONFIG_40x) := head_4xx.o extra-$(CONFIG_40x) := head_4xx.o
extra-$(CONFIG_8xx) := head_8xx.o extra-$(CONFIG_8xx) := head_8xx.o
extra-$(CONFIG_6xx) += idle_6xx.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 \ obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
process.o signal.o ptrace.o align.o \ process.o signal.o ptrace.o align.o \
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# #
EXTRA_CFLAGS += -mno-minimal-toc 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 \ obj-y := setup.o entry.o traps.o irq.o idle.o \
time.o process.o signal.o syscalls.o misc.o ptrace.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 \ 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 \ ...@@ -10,7 +10,7 @@ obj-y := bitmap.o traps.o time.o process.o \
extra-$(CONFIG_ARCH_S390_31) += head.o extra-$(CONFIG_ARCH_S390_31) += head.o
extra-$(CONFIG_ARCH_S390X) += head64.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_MODULES) += s390_ksyms.o module.o
obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smp.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the Linux/SuperH kernel. # 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 \ obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o setup.o time.o sys_sh.o semaphore.o \ ptrace.o setup.o time.o sys_sh.o semaphore.o \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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 EXTRA_AFLAGS := -ansi
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
EXTRA_AFLAGS := -ansi EXTRA_AFLAGS := -ansi
EXTRA_CFLAGS := -Werror 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 \ obj-y := process.o setup.o cpu.o idprom.o \
traps.o devices.o auxio.o \ traps.o devices.o auxio.o \
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Licensed under the GPL # 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 \ 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 \ 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 \ process.o process_kern.o ptrace.o reboot.o resource.o sigio_user.o \
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# for more details. # 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 \ 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 signal.o irq.o mach.o ptrace.o bug.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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 EXTRA_AFLAGS := -traditional
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ 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 \ 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