10b73214fSGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds# 31da177e4SLinus Torvalds# s390/Makefile 41da177e4SLinus Torvalds# 51da177e4SLinus Torvalds# This file is included by the global makefile so that you can add your own 61da177e4SLinus Torvalds# architecture-specific flags and dependencies. Remember to do have actions 71da177e4SLinus Torvalds# for "archclean" and "archdep" for cleaning up and making dependencies for 81da177e4SLinus Torvalds# this architecture 91da177e4SLinus Torvalds# 101da177e4SLinus Torvalds# Copyright (C) 1994 by Linus Torvalds 111da177e4SLinus Torvalds# 121da177e4SLinus Torvalds 131844c9bcSMartin SchwidefskyLD_BFD := elf64-s390 141da177e4SLinus TorvaldsLDFLAGS := -m elf64_s390 157bdc229fSMartin SchwidefskyKBUILD_AFLAGS_MODULE += -fPIC 167bdc229fSMartin SchwidefskyKBUILD_CFLAGS_MODULE += -fPIC 17222d394dSSam RavnborgKBUILD_AFLAGS += -m64 1876bf9d6cSVasily GorbikKBUILD_CFLAGS += -m64 1976bf9d6cSVasily GorbikKBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ 2076bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 2176bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY 2276bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float 2376bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables 2476bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding) 251da177e4SLinus TorvaldsUTS_MACHINE := s390x 261da177e4SLinus TorvaldsSTACK_SIZE := 16384 2714516765SLuc Van OostenryckCHECKFLAGS += -D__s390__ -D__s390x__ 281da177e4SLinus Torvalds 291844c9bcSMartin Schwidefskyexport LD_BFD 301844c9bcSMartin Schwidefsky 310f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z900) := -march=z900 320f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z990) := -march=z990 330f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109 340f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z10) := -march=z10 350f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z196) := -march=z196 360f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_ZEC12) := -march=zEC12 37f8b2dcbdSMartin Schwidefskymflags-$(CONFIG_MARCH_Z13) := -march=z13 386997c323SMartin Schwidefskymflags-$(CONFIG_MARCH_Z14) := -march=z14 390f1b1ff5SHeiko Carstens 4022362a0eSMartin Schwidefskyexport CC_FLAGS_MARCH := $(mflags-y) 4122362a0eSMartin Schwidefsky 420f1b1ff5SHeiko Carstensaflags-y += $(mflags-y) 430f1b1ff5SHeiko Carstenscflags-y += $(mflags-y) 441da177e4SLinus Torvalds 451db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z900_TUNE) += -mtune=z900 461db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z990_TUNE) += -mtune=z990 471db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z9_109_TUNE) += -mtune=z9-109 481db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z10_TUNE) += -mtune=z10 491db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z196_TUNE) += -mtune=z196 501db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_ZEC12_TUNE) += -mtune=zEC12 51f8b2dcbdSMartin Schwidefskycflags-$(CONFIG_MARCH_Z13_TUNE) += -mtune=z13 526997c323SMartin Schwidefskycflags-$(CONFIG_MARCH_Z14_TUNE) += -mtune=z14 531db9e051SHeiko Carstens 54c783b91eSMartin Schwidefskycflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include 55c783b91eSMartin Schwidefsky 56cbbd1fa7SHeiko Carstens# 57cbbd1fa7SHeiko Carstens# Prevent tail-call optimizations, to get clearer backtraces: 58cbbd1fa7SHeiko Carstens# 59cbbd1fa7SHeiko Carstenscflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls 60cbbd1fa7SHeiko Carstens 611da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mpacked-stack),y) 621da177e4SLinus Torvaldscflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK 631da177e4SLinus Torvaldsaflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK 641da177e4SLinus Torvaldsendif 651da177e4SLinus Torvalds 6676bf9d6cSVasily GorbikKBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y) 6776bf9d6cSVasily GorbikKBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y) 6876bf9d6cSVasily Gorbik 691da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) 701da177e4SLinus Torvaldscflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) 71be796285SMartin Schwidefskyifneq ($(call cc-option-yn,-mstack-size=8192),y) 721da177e4SLinus Torvaldscflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) 731da177e4SLinus Torvaldsendif 74be796285SMartin Schwidefskyendif 751da177e4SLinus Torvalds 7676bf9d6cSVasily Gorbikifdef CONFIG_WARN_DYNAMIC_STACK 771da177e4SLinus Torvalds ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) 7876bf9d6cSVasily Gorbik KBUILD_CFLAGS += -mwarn-dynamicstack 7976bf9d6cSVasily Gorbik KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack 8076bf9d6cSVasily Gorbik endif 811da177e4SLinus Torvaldsendif 821da177e4SLinus Torvalds 83f19fbd5eSMartin Schwidefskyifdef CONFIG_EXPOLINE 84f19fbd5eSMartin Schwidefsky ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y) 85f19fbd5eSMartin Schwidefsky CC_FLAGS_EXPOLINE := -mindirect-branch=thunk 86f19fbd5eSMartin Schwidefsky CC_FLAGS_EXPOLINE += -mfunction-return=thunk 87f19fbd5eSMartin Schwidefsky CC_FLAGS_EXPOLINE += -mindirect-branch-table 88f19fbd5eSMartin Schwidefsky export CC_FLAGS_EXPOLINE 896e179d64SMartin Schwidefsky cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE 90157484abSVasily Gorbik aflags-y += -DCC_USING_EXPOLINE 91f19fbd5eSMartin Schwidefsky endif 92f19fbd5eSMartin Schwidefskyendif 93f19fbd5eSMartin Schwidefsky 94e6d60b36SHeiko Carstensifdef CONFIG_FUNCTION_TRACER 95e6d60b36SHeiko Carstens# make use of hotpatch feature if the compiler supports it 96e6d60b36SHeiko Carstenscc_hotpatch := -mhotpatch=0,3 97e6d60b36SHeiko Carstensifeq ($(call cc-option-yn,$(cc_hotpatch)),y) 98e6d60b36SHeiko CarstensCC_FLAGS_FTRACE := $(cc_hotpatch) 99e6d60b36SHeiko CarstensKBUILD_AFLAGS += -DCC_USING_HOTPATCH 100e6d60b36SHeiko CarstensKBUILD_CFLAGS += -DCC_USING_HOTPATCH 101e6d60b36SHeiko Carstensendif 102e6d60b36SHeiko Carstensendif 103e6d60b36SHeiko Carstens 1047bceec4eSHendrik Brueckner# Test CFI features of binutils 1057bceec4eSHendrik Bruecknercfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1) 1067bceec4eSHendrik Brueckner 107a0f97e06SSam RavnborgKBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y) 108a0f97e06SSam RavnborgKBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare 1097bceec4eSHendrik BruecknerKBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi) 1107bceec4eSHendrik BruecknerKBUILD_AFLAGS += $(aflags-y) $(cfi) 11176bf9d6cSVasily Gorbikexport KBUILD_AFLAGS_DECOMPRESSOR 11276bf9d6cSVasily Gorbikexport KBUILD_CFLAGS_DECOMPRESSOR 1131da177e4SLinus Torvalds 1141da177e4SLinus TorvaldsOBJCOPYFLAGS := -O binary 1151da177e4SLinus Torvalds 1161844c9bcSMartin Schwidefskyhead-y := arch/s390/kernel/head.o 1175a79859aSHeiko Carstenshead-y += arch/s390/kernel/head64.o 1181da177e4SLinus Torvalds 11901485943SHeiko Carstens# See arch/s390/Kbuild for content of core part of the kernel 12001485943SHeiko Carstenscore-y += arch/s390/ 121155af2f9SHans-Joachim Picht 1224562c9ffSMichael Holzheulibs-y += arch/s390/lib/ 1231da177e4SLinus Torvaldsdrivers-y += drivers/s390/ 1241da177e4SLinus Torvalds 1251da177e4SLinus Torvalds# must be linked after kernel 1261da177e4SLinus Torvaldsdrivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/ 1271da177e4SLinus Torvalds 1284562c9ffSMichael Holzheuboot := arch/s390/boot 1295c75824dSHendrik Bruecknersyscalls := arch/s390/kernel/syscalls 130c30f6828SHeiko Carstenstools := arch/s390/tools 1311da177e4SLinus Torvalds 132*00f2fb57SVasily Gorbikall: bzImage 1331da177e4SLinus Torvalds 134e0aa099cSVasily Gorbik#KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg... 135e0aa099cSVasily GorbikKBUILD_IMAGE := $(boot)/bzImage 136e0aa099cSVasily Gorbik 1371da177e4SLinus Torvaldsinstall: vmlinux 1381da177e4SLinus Torvalds $(Q)$(MAKE) $(build)=$(boot) $@ 1391da177e4SLinus Torvalds 140*00f2fb57SVasily GorbikbzImage: vmlinux 1411da177e4SLinus Torvalds $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 1421da177e4SLinus Torvalds 143411ed322SMichael Holzheuzfcpdump: 144411ed322SMichael Holzheu $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 145411ed322SMichael Holzheu 146f3cb31e4SHendrik Bruecknervdso_install: 147f3cb31e4SHendrik Brueckner $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ 148f3cb31e4SHendrik Brueckner $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ 149f3cb31e4SHendrik Brueckner 1501da177e4SLinus Torvaldsarchclean: 1511da177e4SLinus Torvalds $(Q)$(MAKE) $(clean)=$(boot) 152c30f6828SHeiko Carstens $(Q)$(MAKE) $(clean)=$(tools) 153c30f6828SHeiko Carstens 1545c75824dSHendrik Bruecknerarchheaders: 1555c75824dSHendrik Brueckner $(Q)$(MAKE) $(build)=$(syscalls) uapi 1565c75824dSHendrik Brueckner 157c30f6828SHeiko Carstensarchprepare: 1585c75824dSHendrik Brueckner $(Q)$(MAKE) $(build)=$(syscalls) kapi 1597fbf8315SHendrik Brueckner $(Q)$(MAKE) $(build)=$(tools) kapi 1601da177e4SLinus Torvalds 1611da177e4SLinus Torvalds# Don't use tabs in echo arguments 1621da177e4SLinus Torvaldsdefine archhelp 163*00f2fb57SVasily Gorbik echo '* bzImage - Kernel image for IPL ($(boot)/bzImage)' 164b8eecf36SMichael Holzheu echo ' install - Install kernel using' 165b8eecf36SMichael Holzheu echo ' (your) ~/bin/$(INSTALLKERNEL) or' 166b8eecf36SMichael Holzheu echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 167b8eecf36SMichael Holzheu echo ' install to $$(INSTALL_PATH)' 1681da177e4SLinus Torvaldsendef 169