Makefile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # s390/Makefile
  4. #
  5. # This file is included by the global makefile so that you can add your own
  6. # architecture-specific flags and dependencies. Remember to do have actions
  7. # for "archclean" and "archdep" for cleaning up and making dependencies for
  8. # this architecture
  9. #
  10. # Copyright (C) 1994 by Linus Torvalds
  11. #
  12. LD_BFD := elf64-s390
  13. KBUILD_LDFLAGS := -m elf64_s390
  14. KBUILD_AFLAGS_MODULE += -fPIC
  15. KBUILD_CFLAGS_MODULE += -fPIC
  16. KBUILD_AFLAGS += -m64
  17. KBUILD_CFLAGS += -m64
  18. aflags_dwarf := -Wa,-gdwarf-2
  19. KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__
  20. KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
  21. KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2
  22. KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
  23. KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
  24. KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
  25. KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding)
  26. KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
  27. KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
  28. KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
  29. UTS_MACHINE := s390x
  30. STACK_SIZE := 16384
  31. CHECKFLAGS += -D__s390__ -D__s390x__
  32. export LD_BFD
  33. mflags-$(CONFIG_MARCH_Z900) := -march=z900
  34. mflags-$(CONFIG_MARCH_Z990) := -march=z990
  35. mflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109
  36. mflags-$(CONFIG_MARCH_Z10) := -march=z10
  37. mflags-$(CONFIG_MARCH_Z196) := -march=z196
  38. mflags-$(CONFIG_MARCH_ZEC12) := -march=zEC12
  39. mflags-$(CONFIG_MARCH_Z13) := -march=z13
  40. mflags-$(CONFIG_MARCH_Z14) := -march=z14
  41. export CC_FLAGS_MARCH := $(mflags-y)
  42. aflags-y += $(mflags-y)
  43. cflags-y += $(mflags-y)
  44. cflags-$(CONFIG_MARCH_Z900_TUNE) += -mtune=z900
  45. cflags-$(CONFIG_MARCH_Z990_TUNE) += -mtune=z990
  46. cflags-$(CONFIG_MARCH_Z9_109_TUNE) += -mtune=z9-109
  47. cflags-$(CONFIG_MARCH_Z10_TUNE) += -mtune=z10
  48. cflags-$(CONFIG_MARCH_Z196_TUNE) += -mtune=z196
  49. cflags-$(CONFIG_MARCH_ZEC12_TUNE) += -mtune=zEC12
  50. cflags-$(CONFIG_MARCH_Z13_TUNE) += -mtune=z13
  51. cflags-$(CONFIG_MARCH_Z14_TUNE) += -mtune=z14
  52. cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
  53. #
  54. # Prevent tail-call optimizations, to get clearer backtraces:
  55. #
  56. cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
  57. ifeq ($(call cc-option-yn,-mpacked-stack -mbackchain -msoft-float),y)
  58. cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
  59. aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
  60. endif
  61. KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
  62. KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
  63. ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
  64. cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
  65. ifneq ($(call cc-option-yn,-mstack-size=8192),y)
  66. cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
  67. endif
  68. endif
  69. ifdef CONFIG_WARN_DYNAMIC_STACK
  70. ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
  71. KBUILD_CFLAGS += -mwarn-dynamicstack
  72. KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack
  73. endif
  74. endif
  75. ifdef CONFIG_EXPOLINE
  76. ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y)
  77. CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
  78. CC_FLAGS_EXPOLINE += -mfunction-return=thunk
  79. CC_FLAGS_EXPOLINE += -mindirect-branch-table
  80. export CC_FLAGS_EXPOLINE
  81. cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE
  82. aflags-y += -DCC_USING_EXPOLINE
  83. endif
  84. endif
  85. ifdef CONFIG_FUNCTION_TRACER
  86. ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n)
  87. # make use of hotpatch feature if the compiler supports it
  88. cc_hotpatch := -mhotpatch=0,3
  89. ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
  90. CC_FLAGS_FTRACE := $(cc_hotpatch)
  91. KBUILD_AFLAGS += -DCC_USING_HOTPATCH
  92. KBUILD_CFLAGS += -DCC_USING_HOTPATCH
  93. endif
  94. endif
  95. endif
  96. # Test CFI features of binutils
  97. cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
  98. KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
  99. KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
  100. KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi)
  101. KBUILD_AFLAGS += $(aflags-y) $(cfi)
  102. export KBUILD_AFLAGS_DECOMPRESSOR
  103. export KBUILD_CFLAGS_DECOMPRESSOR
  104. OBJCOPYFLAGS := -O binary
  105. head-y := arch/s390/kernel/head64.o
  106. # See arch/s390/Kbuild for content of core part of the kernel
  107. core-y += arch/s390/
  108. libs-y += arch/s390/lib/
  109. drivers-y += drivers/s390/
  110. # must be linked after kernel
  111. drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
  112. boot := arch/s390/boot
  113. syscalls := arch/s390/kernel/syscalls
  114. tools := arch/s390/tools
  115. all: bzImage
  116. #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
  117. KBUILD_IMAGE := $(boot)/bzImage
  118. install:
  119. $(Q)$(MAKE) $(build)=$(boot) $@
  120. bzImage: vmlinux
  121. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  122. zfcpdump:
  123. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  124. vdso_install:
  125. $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
  126. $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
  127. archclean:
  128. $(Q)$(MAKE) $(clean)=$(boot)
  129. $(Q)$(MAKE) $(clean)=$(tools)
  130. archheaders:
  131. $(Q)$(MAKE) $(build)=$(syscalls) uapi
  132. archprepare:
  133. $(Q)$(MAKE) $(build)=$(syscalls) kapi
  134. $(Q)$(MAKE) $(build)=$(tools) kapi
  135. # Don't use tabs in echo arguments
  136. define archhelp
  137. echo '* bzImage - Kernel image for IPL ($(boot)/bzImage)'
  138. echo ' install - Install kernel using'
  139. echo ' (your) ~/bin/$(INSTALLKERNEL) or'
  140. echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
  141. echo ' install to $$(INSTALL_PATH)'
  142. endef