162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci# ===========================================================================
362306a36Sopenharmony_ci# Post-link powerpc pass
462306a36Sopenharmony_ci# ===========================================================================
562306a36Sopenharmony_ci#
662306a36Sopenharmony_ci# 1. Check that vmlinux relocations look sane
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciPHONY := __archpost
962306a36Sopenharmony_ci__archpost:
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci-include include/config/auto.conf
1262306a36Sopenharmony_ciinclude $(srctree)/scripts/Kbuild.include
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciquiet_cmd_head_check = CHKHEAD $@
1562306a36Sopenharmony_ci      cmd_head_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/head_check.sh "$(NM)" "$@"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciquiet_cmd_relocs_check = CHKREL  $@
1862306a36Sopenharmony_ciifdef CONFIG_PPC_BOOK3S_64
1962306a36Sopenharmony_ci      cmd_relocs_check =						\
2062306a36Sopenharmony_ci	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" ; \
2162306a36Sopenharmony_ci	$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$(NM)" "$@"
2262306a36Sopenharmony_cielse
2362306a36Sopenharmony_ci      cmd_relocs_check =						\
2462306a36Sopenharmony_ci	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"
2562306a36Sopenharmony_ciendif
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci# `@true` prevents complaint when there is nothing to be done
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_civmlinux: FORCE
3062306a36Sopenharmony_ci	@true
3162306a36Sopenharmony_ciifdef CONFIG_PPC64
3262306a36Sopenharmony_ci	$(call cmd,head_check)
3362306a36Sopenharmony_ciendif
3462306a36Sopenharmony_ciifdef CONFIG_RELOCATABLE
3562306a36Sopenharmony_ci	$(call if_changed,relocs_check)
3662306a36Sopenharmony_ciendif
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci%.ko: FORCE
3962306a36Sopenharmony_ci	@true
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciclean:
4262306a36Sopenharmony_ci	rm -f .tmp_symbols.txt
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciPHONY += FORCE clean
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciFORCE:
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci.PHONY: $(PHONY)
49