1# SPDX-License-Identifier: GPL-2.0
2# ===========================================================================
3# Post-link LoongArch pass
4# ===========================================================================
5#
6# 1. Insert relocations into vmlinux
7
8PHONY := __archpost
9__archpost:
10
11-include include/config/auto.conf
12include scripts/Kbuild.include
13
14CMD_RELOCS = arch/loongarch/boot/tools/relocs --keep
15quiet_cmd_relocs = RELOCS  $@
16      cmd_relocs = $(CMD_RELOCS) $@
17
18quiet_cmd_strip_relocs = RSTRIP  $@
19      cmd_strip_relocs = \
20	$(OBJCOPY) --remove-section='.rel.*' --remove-section='.rel__*' \
21		   --remove-section='.rela.*' --remove-section='.rela__*' $@
22
23# `@true` prevents complaint when there is nothing to be done
24
25vmlinux: FORCE
26	@true
27ifeq ($(CONFIG_RELOCATABLE),y)
28	$(call cmd,relocs)
29	$(call cmd,strip_relocs)
30endif
31
32%.ko: FORCE
33	@true
34
35clean:
36	@true
37
38PHONY += FORCE clean
39
40FORCE:
41
42.PHONY: $(PHONY)
43