18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# ===========================================================================
38c2ecf20Sopenharmony_ci# Post-link MIPS pass
48c2ecf20Sopenharmony_ci# ===========================================================================
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# 1. Check that Loongson3 LL/SC workarounds are applied correctly
78c2ecf20Sopenharmony_ci# 2. Insert relocations into vmlinux
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciPHONY := __archpost
108c2ecf20Sopenharmony_ci__archpost:
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci-include include/config/auto.conf
138c2ecf20Sopenharmony_ciinclude scripts/Kbuild.include
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciCMD_LS3_LLSC = arch/mips/tools/loongson3-llsc-check
168c2ecf20Sopenharmony_ciquiet_cmd_ls3_llsc = LLSCCHK $@
178c2ecf20Sopenharmony_ci      cmd_ls3_llsc = $(CMD_LS3_LLSC) $@
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciCMD_RELOCS = arch/mips/boot/tools/relocs
208c2ecf20Sopenharmony_ciquiet_cmd_relocs = RELOCS  $@
218c2ecf20Sopenharmony_ci      cmd_relocs = $(CMD_RELOCS) $@
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci# `@true` prevents complaint when there is nothing to be done
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_civmlinux: FORCE
268c2ecf20Sopenharmony_ci	@true
278c2ecf20Sopenharmony_ciifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
288c2ecf20Sopenharmony_ci	$(call if_changed,ls3_llsc)
298c2ecf20Sopenharmony_ciendif
308c2ecf20Sopenharmony_ciifeq ($(CONFIG_RELOCATABLE),y)
318c2ecf20Sopenharmony_ci	$(call if_changed,relocs)
328c2ecf20Sopenharmony_ciendif
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci%.ko: FORCE
358c2ecf20Sopenharmony_ci	@true
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciclean:
388c2ecf20Sopenharmony_ci	@true
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciPHONY += FORCE clean
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciFORCE:
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci.PHONY: $(PHONY)
45