Commit 66f85651 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Common rule for preprocessing vmlinux.lds

Some archs use the C preprocessor to adapt their vmlinux.lds script.
Introduce a common rule for these arch/*/Makefile's to use.
parent 66f1fd2f
......@@ -315,6 +315,12 @@ $(SUBDIRS): .hdepend prepare
prepare: include/linux/version.h include/asm include/config/MARKER
@echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'
# This can be used by arch/$ARCH/Makefile to preprocess
# their vmlinux.lds.S file
arch/$ARCH/vmlinux.lds.s: arch/$ARCH/vmlinux.lds.S
$(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -P -C -U$(ARCH) $< -o $@
# Single targets
# ---------------------------------------------------------------------------
......
......@@ -10,7 +10,7 @@
NM := $(NM) -B
LDFLAGS_vmlinux = -static -T arch/alpha/vmlinux.lds -N #-relax
LDFLAGS_vmlinux = -static -T arch/alpha/vmlinux.lds.s -N #-relax
CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS.
......@@ -124,13 +124,9 @@ archclean:
@$(MAKEBOOT) clean
archmrproper:
rm -f arch/alpha/vmlinux.lds
rm -f include/asm-alpha/asm_offsets.h
vmlinux: arch/alpha/vmlinux.lds
arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in
$(CPP) $(CPPFLAGS) -xc -P arch/alpha/vmlinux.lds.in -o arch/alpha/vmlinux.lds
vmlinux: arch/alpha/vmlinux.lds.s
bootpfile:
@$(MAKEBOOT) bootpfile
......
......@@ -14,7 +14,7 @@ AWK := awk
export AWK
OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static -T arch/$(ARCH)/vmlinux.lds
LDFLAGS_vmlinux := -static -T arch/$(ARCH)/vmlinux.lds.s
AFLAGS_KERNEL := -mconstant-gp
EXTRA =
......@@ -94,10 +94,9 @@ LIBS := $(TOPDIR)/arch/$(ARCH)/lib/lib.a $(LIBS) \
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds
vmlinux: arch/$(ARCH)/vmlinux.lds.s
arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE
$(CPP) $(AFLAGS) -C -P -traditional $< > $@
CPPFLAGS_arch/ia64/vmlinux.lds.s := -traditional
compressed: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp
......@@ -124,7 +123,6 @@ archclean:
@$(MAKEBOOT) clean
archmrproper:
rm -f arch/$(ARCH)/vmlinux.lds
@$(MAKE) -C arch/$(ARCH)/tools mrproper
bootpfile:
......
......@@ -117,7 +117,7 @@ endif
#
ifdef CONFIG_BOOT_ELF32
CFLAGS += -Wa,-32
LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf32
LDFLAGS_vmlinux += -T arch/mips64/vmlinux.lds.s
endif
#
# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
......@@ -125,7 +125,7 @@ endif
#
ifdef CONFIG_BOOT_ELF64
CFLAGS += -Wa,-32
LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf32
LDFLAGS_vmlinux += -T arch/mips64/vmlinux.lds.s
#AS += -64
#LDFLAGS += -m elf64bmip
#LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf64
......@@ -147,9 +147,9 @@ else
64bit-bfd = elf64-bigmips
endif
vmlinux: arch/mips64/ld.script.elf32
arch/mips64/ld.script.elf32: arch/mips64/ld.script.elf32.S
$(CPP) $(CPPFLAGS) -C -P -imacros $(srctree)/include/asm-mips64/sn/mapped_kernel.h -Umips $< > $@
vmlinux: arch/mips64/vmlinux.lds.s
CPPFLAGS_arch/mips64/vmlinux.lds.s := -imacros $(srctree)/include/asm-mips64/sn/mapped_kernel.h
ifdef CONFIG_MAPPED_KERNEL
vmlinux.64: vmlinux
......@@ -170,7 +170,6 @@ zdisk: vmlinux
archclean:
@$(MAKEBOOT) clean
$(MAKE) -C arch/$(ARCH)/tools clean
rm -f vmlinux.64 arch/$(ARCH)/ld.script.elf32
archmrproper:
@$(MAKEBOOT) mrproper
......
......@@ -19,7 +19,6 @@
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
CPP=$(CC) -E
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
LDFLAGS_vmlinux =-T arch/parisc/vmlinux.lds
......
......@@ -14,7 +14,6 @@
#
LDFLAGS := -m elf64_s390
CPP=$(CC) -E
OBJCOPYFLAGS := -O binary
ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390x/vmlinux-shared.lds
......
......@@ -45,7 +45,7 @@ endif
# error messages during linking. Select a default linkscript if
# none has been choosen above.
#
LINKSCRIPT = arch/sh/vmlinux.lds
LINKSCRIPT = arch/sh/vmlinux.lds.s
LDFLAGS_vmlinux += -T $(word 1,$(LINKSCRIPT)) -e _stext
ifdef LOADADDR
......@@ -70,10 +70,9 @@ SUBDIRS += arch/sh/stboards
CORE_FILES += arch/sh/stboards/stboards.o
endif
vmlinux: arch/sh/vmlinux.lds
vmlinux: arch/sh/vmlinux.lds.s
arch/sh/vmlinux.lds: arch/sh/vmlinux.lds.S FORCE
$(CPP) $(CPPFLAGS) -traditional -C -P -Ush $< > $@
CPPFLAGS_arch/sh/vmlinux.lds.s := -traditional
FORCE: ;
......@@ -92,4 +91,4 @@ archclean:
# $(MAKE) -C arch/$(ARCH)/tools clean
archmrproper:
rm -f arch/sh/vmlinux.lds
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