Makefile.postlink 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # SPDX-License-Identifier: GPL-2.0
  2. # ===========================================================================
  3. # Post-link riscv pass
  4. # ===========================================================================
  5. #
  6. # Check that vmlinux relocations look sane
  7. PHONY := __archpost
  8. __archpost:
  9. -include include/config/auto.conf
  10. include $(srctree)/scripts/Kbuild.include
  11. quiet_cmd_relocs_check = CHKREL $@
  12. cmd_relocs_check = \
  13. $(CONFIG_SHELL) $(srctree)/arch/riscv/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"
  14. ifdef CONFIG_RELOCATABLE
  15. quiet_cmd_cp_vmlinux_relocs = CPREL vmlinux.relocs
  16. cmd_cp_vmlinux_relocs = cp vmlinux vmlinux.relocs
  17. quiet_cmd_relocs_strip = STRIPREL $@
  18. cmd_relocs_strip = $(OBJCOPY) --remove-section='.rel.*' \
  19. --remove-section='.rel__*' \
  20. --remove-section='.rela.*' \
  21. --remove-section='.rela__*' $@
  22. endif
  23. # `@true` prevents complaint when there is nothing to be done
  24. vmlinux: FORCE
  25. @true
  26. ifdef CONFIG_RELOCATABLE
  27. $(call if_changed,relocs_check)
  28. $(call if_changed,cp_vmlinux_relocs)
  29. $(call if_changed,relocs_strip)
  30. endif
  31. clean:
  32. @true
  33. PHONY += FORCE clean
  34. FORCE:
  35. .PHONY: $(PHONY)