Makefile.postlink 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. PHONY := __archpost
  9. __archpost:
  10. -include include/config/auto.conf
  11. include $(srctree)/scripts/Kbuild.include
  12. CMD_RELOCS = arch/x86/tools/relocs
  13. OUT_RELOCS = arch/x86/boot/compressed
  14. quiet_cmd_relocs = RELOCS $(OUT_RELOCS)/$@.relocs
  15. cmd_relocs = \
  16. mkdir -p $(OUT_RELOCS); \
  17. $(CMD_RELOCS) $@ > $(OUT_RELOCS)/$@.relocs; \
  18. $(CMD_RELOCS) --abs-relocs $@
  19. quiet_cmd_strip_relocs = RSTRIP $@
  20. cmd_strip_relocs = \
  21. $(OBJCOPY) --remove-section='.rel.*' --remove-section='.rel__*' \
  22. --remove-section='.rela.*' --remove-section='.rela__*' $@
  23. # `@true` prevents complaint when there is nothing to be done
  24. vmlinux: FORCE
  25. @true
  26. ifeq ($(CONFIG_X86_NEED_RELOCS),y)
  27. $(call cmd,relocs)
  28. $(call cmd,strip_relocs)
  29. endif
  30. clean:
  31. @rm -f $(OUT_RELOCS)/vmlinux.relocs
  32. PHONY += FORCE clean
  33. FORCE:
  34. .PHONY: $(PHONY)