Commit 44079d35 authored by Matt Redfearn's avatar Matt Redfearn Committed by Ralf Baechle

MIPS: Use Makefile.postlink to insert relocations into vmlinux

When relocatable support for MIPS was merged, there was no support for
an architecture to add a postlink step for vmlinux. This meant that only
invoking a target within the boot directory, such as uImage, caused the
relocations to be inserted into vmlinux. Building just the vmlinux
target would result in a relocatable kernel with no relocation
information present.

Commit fbe6e37d ("kbuild: add arch specific post-link Makefile")
recified this situation, so MIPS can now define a postlink step to add
relocation information into vmlinux, and remove the additional steps
tacked onto boot targets.
Signed-off-by: default avatarMatt Redfearn <matt.redfearn@imgtec.com>
Tested-by: default avatarSteven J. Hill <steven.hill@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14554/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 096a0de4
...@@ -330,10 +330,6 @@ rom.bin rom.sw: vmlinux ...@@ -330,10 +330,6 @@ rom.bin rom.sw: vmlinux
$(bootvars-y) $@ $(bootvars-y) $@
endif endif
CMD_RELOCS = arch/mips/boot/tools/relocs
quiet_cmd_relocs = RELOCS $<
cmd_relocs = $(CMD_RELOCS) $<
# #
# Some machines like the Indy need 32-bit ELF binaries for booting purposes. # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
# Other need ECOFF, so we build a 32-bit ELF binary for them which we then # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
...@@ -342,11 +338,6 @@ quiet_cmd_relocs = RELOCS $< ...@@ -342,11 +338,6 @@ quiet_cmd_relocs = RELOCS $<
quiet_cmd_32 = OBJCOPY $@ quiet_cmd_32 = OBJCOPY $@
cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
vmlinux.32: vmlinux vmlinux.32: vmlinux
ifeq ($(CONFIG_RELOCATABLE)$(CONFIG_64BIT),yy)
# Currently, objcopy fails to handle the relocations in the elf64
# So the relocs tool must be run here to remove them first
$(call cmd,relocs)
endif
$(call cmd,32) $(call cmd,32)
# #
...@@ -362,9 +353,6 @@ all: $(all-y) ...@@ -362,9 +353,6 @@ all: $(all-y)
# boot # boot
$(boot-y): $(vmlinux-32) FORCE $(boot-y): $(vmlinux-32) FORCE
ifeq ($(CONFIG_RELOCATABLE)$(CONFIG_32BIT),yy)
$(call cmd,relocs)
endif
$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \ $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
$(bootvars-y) arch/mips/boot/$@ $(bootvars-y) arch/mips/boot/$@
......
# ===========================================================================
# Post-link MIPS pass
# ===========================================================================
#
# 1. Insert relocations into vmlinux
PHONY := __archpost
__archpost:
include include/config/auto.conf
include scripts/Kbuild.include
CMD_RELOCS = arch/mips/boot/tools/relocs
quiet_cmd_relocs = RELOCS $@
cmd_relocs = $(CMD_RELOCS) $@
# `@true` prevents complaint when there is nothing to be done
vmlinux: FORCE
@true
ifeq ($(CONFIG_RELOCATABLE),y)
$(call if_changed,relocs)
endif
%.ko: FORCE
@true
clean:
@true
PHONY += FORCE clean
FORCE:
.PHONY: $(PHONY)
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