Greg Kroah-Hartman | 0b73214 | 2017-11-24 15:00:38 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | # |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | # Copyright (C) 1994 by Linus Torvalds |
| 11 | # |
| 12 | |
Martin Schwidefsky | 1844c9b | 2010-02-26 22:37:53 +0100 | [diff] [blame] | 13 | LD_BFD := elf64-s390 |
Masahiro Yamada | d503ac5 | 2018-08-24 08:20:39 +0900 | [diff] [blame] | 14 | KBUILD_LDFLAGS := -m elf64_s390 |
Martin Schwidefsky | 7bdc229 | 2013-01-11 15:26:01 +0100 | [diff] [blame] | 15 | KBUILD_AFLAGS_MODULE += -fPIC |
| 16 | KBUILD_CFLAGS_MODULE += -fPIC |
Sam Ravnborg | 222d394 | 2007-10-15 21:59:31 +0200 | [diff] [blame] | 17 | KBUILD_AFLAGS += -m64 |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 18 | KBUILD_CFLAGS += -m64 |
Gerald Schaefer | 805bc0b | 2019-02-03 21:35:45 +0100 | [diff] [blame] | 19 | ifeq ($(CONFIG_RELOCATABLE),y) |
| 20 | KBUILD_CFLAGS += -fPIE |
| 21 | LDFLAGS_vmlinux := -pie |
| 22 | endif |
Vasily Gorbik | ee6d777 | 2018-06-28 19:22:21 +0200 | [diff] [blame] | 23 | aflags_dwarf := -Wa,-gdwarf-2 |
Arnd Bergmann | 96fb54a | 2019-04-15 10:35:52 +0200 | [diff] [blame] | 24 | KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ |
Vasily Gorbik | ee6d777 | 2018-06-28 19:22:21 +0200 | [diff] [blame] | 25 | KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) |
Arnd Bergmann | 96fb54a | 2019-04-15 10:35:52 +0200 | [diff] [blame] | 26 | KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 27 | KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY |
Vasily Gorbik | 8977ab6 | 2020-11-10 17:05:35 +0100 | [diff] [blame^] | 28 | KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 29 | KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables |
Masahiro Yamada | 685969e | 2020-06-27 03:59:13 +0900 | [diff] [blame] | 30 | KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding |
Heiko Carstens | f9364df | 2019-06-04 13:10:51 +0200 | [diff] [blame] | 31 | KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) |
Vasily Gorbik | ee6d777 | 2018-06-28 19:22:21 +0200 | [diff] [blame] | 32 | KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) |
| 33 | KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | UTS_MACHINE := s390x |
Vasily Gorbik | 9fed920 | 2018-10-26 15:29:59 +0200 | [diff] [blame] | 35 | STACK_SIZE := $(if $(CONFIG_KASAN),65536,16384) |
Luc Van Oostenryck | 14516765 | 2018-05-28 20:27:35 +0200 | [diff] [blame] | 36 | CHECKFLAGS += -D__s390__ -D__s390x__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Martin Schwidefsky | 1844c9b | 2010-02-26 22:37:53 +0100 | [diff] [blame] | 38 | export LD_BFD |
| 39 | |
Heiko Carstens | 0f1b1ff | 2014-08-14 16:06:02 +0200 | [diff] [blame] | 40 | mflags-$(CONFIG_MARCH_Z900) := -march=z900 |
| 41 | mflags-$(CONFIG_MARCH_Z990) := -march=z990 |
| 42 | mflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109 |
| 43 | mflags-$(CONFIG_MARCH_Z10) := -march=z10 |
| 44 | mflags-$(CONFIG_MARCH_Z196) := -march=z196 |
| 45 | mflags-$(CONFIG_MARCH_ZEC12) := -march=zEC12 |
Martin Schwidefsky | 6997c32 | 2017-04-12 14:17:25 +0200 | [diff] [blame] | 46 | mflags-$(CONFIG_MARCH_Z13) := -march=z13 |
| 47 | mflags-$(CONFIG_MARCH_Z14) := -march=z14 |
Martin Schwidefsky | a0e2251 | 2019-02-06 08:22:11 +0100 | [diff] [blame] | 48 | mflags-$(CONFIG_MARCH_Z15) := -march=z15 |
Heiko Carstens | 0f1b1ff | 2014-08-14 16:06:02 +0200 | [diff] [blame] | 49 | |
Martin Schwidefsky | 22362a0 | 2015-07-08 10:20:04 +0200 | [diff] [blame] | 50 | export CC_FLAGS_MARCH := $(mflags-y) |
| 51 | |
Heiko Carstens | 0f1b1ff | 2014-08-14 16:06:02 +0200 | [diff] [blame] | 52 | aflags-y += $(mflags-y) |
| 53 | cflags-y += $(mflags-y) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Heiko Carstens | 1db9e05 | 2013-10-30 12:12:50 +0100 | [diff] [blame] | 55 | cflags-$(CONFIG_MARCH_Z900_TUNE) += -mtune=z900 |
| 56 | cflags-$(CONFIG_MARCH_Z990_TUNE) += -mtune=z990 |
| 57 | cflags-$(CONFIG_MARCH_Z9_109_TUNE) += -mtune=z9-109 |
| 58 | cflags-$(CONFIG_MARCH_Z10_TUNE) += -mtune=z10 |
| 59 | cflags-$(CONFIG_MARCH_Z196_TUNE) += -mtune=z196 |
| 60 | cflags-$(CONFIG_MARCH_ZEC12_TUNE) += -mtune=zEC12 |
Martin Schwidefsky | 6997c32 | 2017-04-12 14:17:25 +0200 | [diff] [blame] | 61 | cflags-$(CONFIG_MARCH_Z13_TUNE) += -mtune=z13 |
| 62 | cflags-$(CONFIG_MARCH_Z14_TUNE) += -mtune=z14 |
Martin Schwidefsky | a0e2251 | 2019-02-06 08:22:11 +0100 | [diff] [blame] | 63 | cflags-$(CONFIG_MARCH_Z15_TUNE) += -mtune=z15 |
Heiko Carstens | 1db9e05 | 2013-10-30 12:12:50 +0100 | [diff] [blame] | 64 | |
Martin Schwidefsky | c783b91 | 2016-09-06 10:46:36 +0200 | [diff] [blame] | 65 | cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include |
| 66 | |
Heiko Carstens | cbbd1fa | 2006-07-03 00:24:38 -0700 | [diff] [blame] | 67 | # |
| 68 | # Prevent tail-call optimizations, to get clearer backtraces: |
| 69 | # |
| 70 | cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls |
| 71 | |
Vasily Gorbik | 253b3c4 | 2020-01-08 14:46:00 +0100 | [diff] [blame] | 72 | ifeq ($(call cc-option-yn,-mpacked-stack -mbackchain -msoft-float),y) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK |
| 74 | aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | endif |
| 76 | |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 77 | KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y) |
| 78 | KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y) |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) |
| 81 | cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) |
Martin Schwidefsky | be79628 | 2007-04-27 16:01:46 +0200 | [diff] [blame] | 82 | ifneq ($(call cc-option-yn,-mstack-size=8192),y) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) |
| 84 | endif |
Martin Schwidefsky | be79628 | 2007-04-27 16:01:46 +0200 | [diff] [blame] | 85 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 87 | ifdef CONFIG_WARN_DYNAMIC_STACK |
| 88 | ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) |
| 89 | KBUILD_CFLAGS += -mwarn-dynamicstack |
| 90 | KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack |
| 91 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | endif |
| 93 | |
Martin Schwidefsky | f19fbd5 | 2018-01-26 12:46:47 +0100 | [diff] [blame] | 94 | ifdef CONFIG_EXPOLINE |
| 95 | ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y) |
| 96 | CC_FLAGS_EXPOLINE := -mindirect-branch=thunk |
| 97 | CC_FLAGS_EXPOLINE += -mfunction-return=thunk |
| 98 | CC_FLAGS_EXPOLINE += -mindirect-branch-table |
| 99 | export CC_FLAGS_EXPOLINE |
Martin Schwidefsky | 6e179d6 | 2018-03-23 13:04:49 +0100 | [diff] [blame] | 100 | cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE |
Vasily Gorbik | 157484a | 2018-06-15 10:22:18 +0200 | [diff] [blame] | 101 | aflags-y += -DCC_USING_EXPOLINE |
Martin Schwidefsky | f19fbd5 | 2018-01-26 12:46:47 +0100 | [diff] [blame] | 102 | endif |
| 103 | endif |
| 104 | |
Heiko Carstens | e6d60b3 | 2015-01-09 13:08:28 +0100 | [diff] [blame] | 105 | ifdef CONFIG_FUNCTION_TRACER |
Vasily Gorbik | d983c89 | 2018-08-06 15:17:47 +0200 | [diff] [blame] | 106 | ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n) |
| 107 | # make use of hotpatch feature if the compiler supports it |
| 108 | cc_hotpatch := -mhotpatch=0,3 |
| 109 | ifeq ($(call cc-option-yn,$(cc_hotpatch)),y) |
| 110 | CC_FLAGS_FTRACE := $(cc_hotpatch) |
| 111 | KBUILD_AFLAGS += -DCC_USING_HOTPATCH |
| 112 | KBUILD_CFLAGS += -DCC_USING_HOTPATCH |
| 113 | endif |
| 114 | endif |
Heiko Carstens | e6d60b3 | 2015-01-09 13:08:28 +0100 | [diff] [blame] | 115 | endif |
| 116 | |
Hendrik Brueckner | 7bceec4 | 2017-11-20 11:46:13 +0100 | [diff] [blame] | 117 | # Test CFI features of binutils |
| 118 | cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1) |
| 119 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 120 | KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y) |
Arnd Bergmann | c1afcae | 2019-04-08 23:26:14 +0200 | [diff] [blame] | 121 | KBUILD_CFLAGS += -pipe -Wno-sign-compare |
Hendrik Brueckner | 7bceec4 | 2017-11-20 11:46:13 +0100 | [diff] [blame] | 122 | KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi) |
| 123 | KBUILD_AFLAGS += $(aflags-y) $(cfi) |
Vasily Gorbik | 76bf9d6 | 2018-06-15 12:28:05 +0200 | [diff] [blame] | 124 | export KBUILD_AFLAGS_DECOMPRESSOR |
| 125 | export KBUILD_CFLAGS_DECOMPRESSOR |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | |
| 127 | OBJCOPYFLAGS := -O binary |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
Vasily Gorbik | 8282cd6 | 2018-06-12 15:11:40 +0200 | [diff] [blame] | 129 | head-y := arch/s390/kernel/head64.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | |
Heiko Carstens | 0148594 | 2010-10-25 16:10:09 +0200 | [diff] [blame] | 131 | # See arch/s390/Kbuild for content of core part of the kernel |
| 132 | core-y += arch/s390/ |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 133 | |
Michael Holzheu | 4562c9f | 2007-02-21 10:55:46 +0100 | [diff] [blame] | 134 | libs-y += arch/s390/lib/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | drivers-y += drivers/s390/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
| 137 | # must be linked after kernel |
| 138 | drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/ |
| 139 | |
Michael Holzheu | 4562c9f | 2007-02-21 10:55:46 +0100 | [diff] [blame] | 140 | boot := arch/s390/boot |
Hendrik Brueckner | 5c75824 | 2017-12-11 14:54:08 +0100 | [diff] [blame] | 141 | syscalls := arch/s390/kernel/syscalls |
Heiko Carstens | c30f682 | 2015-02-02 07:08:44 +0100 | [diff] [blame] | 142 | tools := arch/s390/tools |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Vasily Gorbik | 00f2fb5 | 2018-06-11 14:35:01 +0200 | [diff] [blame] | 144 | all: bzImage |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Vasily Gorbik | e0aa099 | 2018-02-20 11:31:34 +0100 | [diff] [blame] | 146 | #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg... |
| 147 | KBUILD_IMAGE := $(boot)/bzImage |
| 148 | |
Masahiro Yamada | 94e90f7 | 2020-02-16 23:48:29 +0900 | [diff] [blame] | 149 | install: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | $(Q)$(MAKE) $(build)=$(boot) $@ |
| 151 | |
Vasily Gorbik | 00f2fb5 | 2018-06-11 14:35:01 +0200 | [diff] [blame] | 152 | bzImage: vmlinux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 154 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 155 | zfcpdump: |
| 156 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 157 | |
Hendrik Brueckner | f3cb31e | 2010-05-17 10:00:09 +0200 | [diff] [blame] | 158 | vdso_install: |
Hendrik Brueckner | f3cb31e | 2010-05-17 10:00:09 +0200 | [diff] [blame] | 159 | $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ |
Hendrik Brueckner | f3cb31e | 2010-05-17 10:00:09 +0200 | [diff] [blame] | 160 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | archclean: |
| 162 | $(Q)$(MAKE) $(clean)=$(boot) |
Heiko Carstens | c30f682 | 2015-02-02 07:08:44 +0100 | [diff] [blame] | 163 | $(Q)$(MAKE) $(clean)=$(tools) |
| 164 | |
Hendrik Brueckner | 5c75824 | 2017-12-11 14:54:08 +0100 | [diff] [blame] | 165 | archheaders: |
| 166 | $(Q)$(MAKE) $(build)=$(syscalls) uapi |
| 167 | |
Heiko Carstens | c30f682 | 2015-02-02 07:08:44 +0100 | [diff] [blame] | 168 | archprepare: |
Hendrik Brueckner | 5c75824 | 2017-12-11 14:54:08 +0100 | [diff] [blame] | 169 | $(Q)$(MAKE) $(build)=$(syscalls) kapi |
Hendrik Brueckner | 7fbf831 | 2018-01-11 12:13:18 +0100 | [diff] [blame] | 170 | $(Q)$(MAKE) $(build)=$(tools) kapi |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | # Don't use tabs in echo arguments |
| 173 | define archhelp |
Vasily Gorbik | 00f2fb5 | 2018-06-11 14:35:01 +0200 | [diff] [blame] | 174 | echo '* bzImage - Kernel image for IPL ($(boot)/bzImage)' |
Michael Holzheu | b8eecf3 | 2015-11-25 11:54:36 +0100 | [diff] [blame] | 175 | echo ' install - Install kernel using' |
| 176 | echo ' (your) ~/bin/$(INSTALLKERNEL) or' |
| 177 | echo ' (distribution) /sbin/$(INSTALLKERNEL) or' |
| 178 | echo ' install to $$(INSTALL_PATH)' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | endef |