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