18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# ===========================================================================
38c2ecf20Sopenharmony_ci# Post-link powerpc pass
48c2ecf20Sopenharmony_ci# ===========================================================================
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# 1. Check that vmlinux relocations look sane
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciPHONY := __archpost
98c2ecf20Sopenharmony_ci__archpost:
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci-include include/config/auto.conf
128c2ecf20Sopenharmony_ciinclude scripts/Kbuild.include
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciquiet_cmd_head_check = CHKHEAD $@
158c2ecf20Sopenharmony_ci      cmd_head_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/head_check.sh "$(NM)" "$@"
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciquiet_cmd_relocs_check = CHKREL  $@
188c2ecf20Sopenharmony_ciifdef CONFIG_PPC_BOOK3S_64
198c2ecf20Sopenharmony_ci      cmd_relocs_check =						\
208c2ecf20Sopenharmony_ci	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" ; \
218c2ecf20Sopenharmony_ci	$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$(NM)" "$@"
228c2ecf20Sopenharmony_cielse
238c2ecf20Sopenharmony_ci      cmd_relocs_check =						\
248c2ecf20Sopenharmony_ci	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"
258c2ecf20Sopenharmony_ciendif
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci# `@true` prevents complaint when there is nothing to be done
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_civmlinux: FORCE
308c2ecf20Sopenharmony_ci	@true
318c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
328c2ecf20Sopenharmony_ci	$(call cmd,head_check)
338c2ecf20Sopenharmony_ciendif
348c2ecf20Sopenharmony_ciifdef CONFIG_RELOCATABLE
358c2ecf20Sopenharmony_ci	$(call if_changed,relocs_check)
368c2ecf20Sopenharmony_ciendif
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci%.ko: FORCE
398c2ecf20Sopenharmony_ci	@true
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciclean:
428c2ecf20Sopenharmony_ci	rm -f .tmp_symbols.txt
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciPHONY += FORCE clean
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciFORCE:
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci.PHONY: $(PHONY)
49