Skip to content

Commit f188d05

Browse files
npigginmpe
authored andcommitted
powerpc: Use the new post-link pass to check relocations
Currently powerpc has to introduce a dependency on its default build target zImage in order to run a relocation check pass over the linked vmlinux. This is deficient because the check is not run if the plain vmlinux target is built, or if one of the other boot targets is built. Switch to using the kbuild post-link pass, added in commit fbe6e37 ("kbuild: add arch specific post-link Makefile") in order to run this check. In future powerpc will use this to do more complicated operations, but initially using it for something simple is a good first step. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 1cd6ed7 commit f188d05

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

arch/powerpc/Makefile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,6 @@ PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
274274

275275
boot := arch/$(ARCH)/boot
276276

277-
ifeq ($(CONFIG_RELOCATABLE),y)
278-
quiet_cmd_relocs_check = CALL $<
279-
cmd_relocs_check = $(CONFIG_SHELL) $< "$(OBJDUMP)" "$(obj)/vmlinux"
280-
281-
PHONY += relocs_check
282-
relocs_check: arch/powerpc/relocs_check.sh vmlinux
283-
$(call cmd,relocs_check)
284-
285-
zImage: relocs_check
286-
endif
287-
288277
$(BOOT_TARGETS1): vmlinux
289278
$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
290279
$(BOOT_TARGETS2): vmlinux

arch/powerpc/Makefile.postlink

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ===========================================================================
2+
# Post-link powerpc pass
3+
# ===========================================================================
4+
#
5+
# 1. Check that vmlinux relocations look sane
6+
7+
PHONY := __archpost
8+
__archpost:
9+
10+
include include/config/auto.conf
11+
include scripts/Kbuild.include
12+
13+
quiet_cmd_relocs_check = CHKREL $@
14+
cmd_relocs_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/relocs_check.sh "$(OBJDUMP)" "$@"
15+
16+
# `@true` prevents complaint when there is nothing to be done
17+
18+
vmlinux: FORCE
19+
@true
20+
ifdef CONFIG_RELOCATABLE
21+
$(call if_changed,relocs_check)
22+
endif
23+
24+
%.ko: FORCE
25+
@true
26+
27+
clean:
28+
@true
29+
30+
PHONY += FORCE clean
31+
32+
FORCE:
33+
34+
.PHONY: $(PHONY)

0 commit comments

Comments
 (0)