Commit 26976a3d authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Handle vmlinux linkscript from common code

Now that all archs use the same way to generate the link script, we can
handle it from the common top-level Makefile instead of the individual
arch/*/Makefile's.
parent 761de242
......@@ -297,7 +297,9 @@ define rule_link_vmlinux
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
vmlinux: $(vmlinux-objs) FORCE
LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
vmlinux: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
$(call if_changed_rule,link_vmlinux)
# The actual objects are generated when descending,
......
......@@ -10,7 +10,7 @@
NM := $(NM) -B
LDFLAGS_vmlinux = -static -T arch/alpha/vmlinux.lds.s -N #-relax
LDFLAGS_vmlinux = -static -N #-relax
CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS.
......@@ -126,8 +126,6 @@ archclean:
archmrproper:
rm -f include/asm-alpha/asm_offsets.h
vmlinux: arch/alpha/vmlinux.lds.s
bootpfile:
@$(MAKEBOOT) bootpfile
......
......@@ -7,7 +7,7 @@
#
# Copyright (C) 1995-2001 by Russell King
LDFLAGS_vmlinux :=-p -X -T arch/arm/vmlinux.lds.s
LDFLAGS_vmlinux :=-p -X
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9
#CFLAGS +=-pipe
......@@ -215,8 +215,6 @@ maketools: include/asm-arm/.arch include/asm-arm/.proc \
include/asm-arm/constants.h include/linux/version.h FORCE
@$(MAKETOOLS)
vmlinux: arch/arm/vmlinux.lds.s
bzImage zImage zinstall Image bootpImage install: vmlinux
@$(MAKEBOOT) $@
......
......@@ -15,8 +15,6 @@
LD = $(CROSS_COMPILE)ld -mcrislinux
LDFLAGS_vmlinux = -T arch/$(ARCH)/vmlinux.lds.s
# objcopy is used to make binary images from the resulting linked file
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
......@@ -47,8 +45,6 @@ LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LI
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds.s
vmlinux.bin: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
......
......@@ -18,7 +18,7 @@
LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds.s -e stext
LDFLAGS_vmlinux := -e stext
CFLAGS += -pipe
......@@ -104,8 +104,6 @@ endif
MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds.s
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper
......
......@@ -14,7 +14,7 @@ AWK := awk
export AWK
OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static -T arch/$(ARCH)/vmlinux.lds.s
LDFLAGS_vmlinux := -static
AFLAGS_KERNEL := -mconstant-gp
EXTRA =
......@@ -94,8 +94,6 @@ LIBS := $(TOPDIR)/arch/$(ARCH)/lib/lib.a $(LIBS) \
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds.s
compressed: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp
gzip vmlinux-tmp
......
......@@ -24,10 +24,8 @@ ifneq ($(COMPILE_ARCH),$(ARCH))
CROSS_COMPILE = m68k-linux-
endif
ifndef CONFIG_SUN3
LDFLAGS_vmlinux = -T $(TOPDIR)/arch/m68k/vmlinux.lds.s
else
LDFLAGS_vmlinux = -T $(TOPDIR)/arch/m68k/vmlinux.lds.s -N
ifdef CONFIG_SUN3
LDFLAGS_vmlinux = -N
endif
# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
......@@ -134,8 +132,6 @@ CORE_FILES := $(CORE_FILES) arch/m68k/math-emu/mathemu.o
SUBDIRS := $(SUBDIRS) arch/m68k/math-emu
endif
vmlinux: arch/$(ARCH)/vmlinux.lds.s
lilo: vmlinux
if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi
if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
......
......@@ -266,9 +266,6 @@ endif
# error messages during linking. Select a default linkscript if
# none has been choosen above.
#
vmlinux: arch/$(ARCH)/vmlinux.lds.s
LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
AFLAGS_vmlinux.lds.o := -DLOADADDR=$(LOADADDR)
......
......@@ -117,7 +117,6 @@ endif
#
ifdef CONFIG_BOOT_ELF32
CFLAGS += -Wa,-32
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 +124,6 @@ endif
#
ifdef CONFIG_BOOT_ELF64
CFLAGS += -Wa,-32
LDFLAGS_vmlinux += -T arch/mips64/vmlinux.lds.s
#AS += -64
#LDFLAGS += -m elf64bmip
#LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf64
......@@ -147,8 +145,6 @@ else
64bit-bfd = elf64-bigmips
endif
vmlinux: arch/mips64/vmlinux.lds.s
AFLAGS_vmlinux.lds.o := -imacros $(srctree)/include/asm-mips64/sn/mapped_kernel.h
ifdef CONFIG_MAPPED_KERNEL
......
......@@ -20,7 +20,6 @@
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
LDFLAGS_vmlinux =-T arch/parisc/vmlinux.lds.s
CFLAGS_PIPE := -pipe
CFLAGS_NSR := -fno-strength-reduce
......@@ -55,8 +54,6 @@ SUBDIRS := $(SUBDIRS) arch/parisc/kdb
DRIVERS := $(DRIVERS) arch/parisc/kdb/kdb.o
endif
vmlinux: arch/$(ARCH)/vmlinux.lds.s
palo: vmlinux
export TOPDIR=`pwd`; export CONFIG_STI_CONSOLE=$(CONFIG_STI_CONSOLE); \
unset STRIP LDFLAGS CPP CPPFLAGS AFLAGS CFLAGS CC LD; cd ../palo && make lifimage
......
......@@ -21,7 +21,7 @@ else
KERNELLOAD =0xc0000000
endif
LDFLAGS_vmlinux = -T arch/ppc/vmlinux.lds.s -Ttext $(KERNELLOAD) -Bstatic
LDFLAGS_vmlinux = -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH)
AFLAGS := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH)
CFLAGS := $(CFLAGS) -I$(TOPDIR)/arch/$(ARCH) -fsigned-char \
......@@ -103,8 +103,6 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
# All the instructions talk about "make bzImage".
bzImage: zImage
vmlinux: arch/$(ARCH)/vmlinux.lds.s
$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
......
......@@ -16,7 +16,7 @@
KERNELLOAD =0xc000000000000000
LDFLAGS := -m elf64ppc
LDFLAGS_vmlinux = -T arch/ppc64/vmlinux.lds.s -Bstatic \
LDFLAGS_vmlinux = -Bstatic \
-e $(KERNELLOAD) -Ttext $(KERNELLOAD)
CFLAGS := $(CFLAGS) -msoft-float -pipe \
-Wno-uninitialized -mminimal-toc -mtraceback=full \
......@@ -46,8 +46,6 @@ ifdef CONFIG_PPC_ISERIES
BOOT_TARGETS = vmlinux.sminitrd vmlinux.initrd vmlinux.sm
endif
vmlinux: arch/$(ARCH)/vmlinux.lds.s
$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
......
......@@ -15,7 +15,7 @@
LDFLAGS := -m elf_s390
OBJCOPYFLAGS := -O binary
LDFLAGS_vmlinux := -T arch/$(ARCH)/vmlinux.lds.s -e start
LDFLAGS_vmlinux := -e start
CFLAGS_PIPE := -pipe
CFLAGS_NSR := -fno-strength-reduce
......@@ -41,8 +41,6 @@ listing: vmlinux
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds.s
image: vmlinux
@$(MAKEBOOT) image
......
......@@ -15,7 +15,7 @@
LDFLAGS := -m elf64_s390
OBJCOPYFLAGS := -O binary
LDFLAGS_vmlinux := -T arch/$(ARCH)/vmlinux.lds.s -e start
LDFLAGS_vmlinux := -e start
MODFLAGS += -fpic
CFLAGS_PIPE := -pipe
......@@ -36,8 +36,6 @@ listing: vmlinux
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds.s
image: vmlinux
@$(MAKEBOOT) image
......
......@@ -42,11 +42,9 @@ endif
#
# Choosing incompatible machines durings configuration will result in
# error messages during linking. Select a default linkscript if
# none has been choosen above.
# error messages during linking.
#
LINKSCRIPT = arch/sh/vmlinux.lds.s
LDFLAGS_vmlinux += -T $(word 1,$(LINKSCRIPT)) -e _stext
LDFLAGS_vmlinux += -e _stext
ifdef LOADADDR
LDFLAGS_vmlinux += -Ttext $(word 1,$(LOADADDR))
......@@ -70,8 +68,6 @@ SUBDIRS += arch/sh/stboards
CORE_FILES += arch/sh/stboards/stboards.o
endif
vmlinux: arch/sh/vmlinux.lds.s
AFLAGS_vmlinux.lds.o := -traditional
zImage: vmlinux
......
......@@ -31,7 +31,6 @@ CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
endif
#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
LDFLAGS_vmlinux = -T arch/sparc/vmlinux.lds.s
HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
......@@ -52,8 +51,6 @@ CORE_FILES += arch/sparc/boot/btfix.o
export CORE_FILES_NO_BTFIX
export INIT
vmlinux: arch/$(ARCH)/vmlinux.lds.s
archclean:
rm -f $(TOPDIR)/vmlinux.aout
-$(MAKE) -C arch/sparc/boot clean
......
......@@ -53,8 +53,6 @@ ifeq ($(CONFIG_MCOUNT),y)
CFLAGS := $(CFLAGS) -pg
endif
LDFLAGS_vmlinux = -T arch/sparc64/vmlinux.lds.s
HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
SUBDIRS += arch/sparc64/kernel arch/sparc64/lib arch/sparc64/mm \
......@@ -77,8 +75,6 @@ CORE_FILES += arch/sparc64/math-emu/math-emu.o
LIBS := $(TOPDIR)/lib/lib.a $(LIBS) $(TOPDIR)/arch/sparc64/prom/promlib.a \
$(TOPDIR)/arch/sparc64/lib/lib.a
vmlinux: arch/$(ARCH)/vmlinux.lds.s
vmlinux.aout: vmlinux
$(ELFTOAOUT) -o $(TOPDIR)/vmlinux.aout $(TOPDIR)/vmlinux
......
......@@ -35,7 +35,7 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
LD=$(CROSS_COMPILE)ld -m elf_x86_64
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/x86_64/vmlinux.lds.s -e stext
LDFLAGS_vmlinux := -e stext
CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel
......@@ -66,8 +66,6 @@ CORE_FILES += $(core-y)
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/x86_64/vmlinux.lds.s
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper
......
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