xref: /linux/arch/x86/Makefile.postlink (revision fd8c09ad0d87783b9b6a27900d66293be45b7bad)
1# SPDX-License-Identifier: GPL-2.0
2# ===========================================================================
3# Post-link x86 pass
4# ===========================================================================
5#
6# 1. Separate relocations from vmlinux into vmlinux.relocs.
7# 2. Strip relocations from vmlinux.
8
9PHONY := __archpost
10__archpost:
11
12-include include/config/auto.conf
13include $(srctree)/scripts/Kbuild.include
14include $(srctree)/scripts/Makefile.lib
15
16CMD_RELOCS = arch/x86/tools/relocs
17OUT_RELOCS = arch/x86/boot/compressed
18quiet_cmd_relocs = RELOCS  $(OUT_RELOCS)/$@.relocs
19      cmd_relocs = \
20	mkdir -p $(OUT_RELOCS); \
21	$(CMD_RELOCS) $@ > $(OUT_RELOCS)/$@.relocs; \
22	$(CMD_RELOCS) --abs-relocs $@
23
24# `@true` prevents complaint when there is nothing to be done
25
26vmlinux: FORCE
27	@true
28ifeq ($(CONFIG_X86_NEED_RELOCS),y)
29	$(call cmd,relocs)
30	$(call cmd,strip_relocs)
31endif
32
33clean:
34	@rm -f $(OUT_RELOCS)/vmlinux.relocs
35
36PHONY += FORCE clean
37
38FORCE:
39
40.PHONY: $(PHONY)
41