Linux 4.19-rc7
[linux-2.6/btrfs-unstable.git] / arch / s390 / Makefile
blobee65185bbc807284b8729b5c9d52c129fafba30e
1 # SPDX-License-Identifier: GPL-2.0
3 # s390/Makefile
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
10 # Copyright (C) 1994 by Linus Torvalds
13 LD_BFD := elf64-s390
14 KBUILD_LDFLAGS := -m elf64_s390
15 KBUILD_AFLAGS_MODULE += -fPIC
16 KBUILD_CFLAGS_MODULE += -fPIC
17 KBUILD_AFLAGS += -m64
18 KBUILD_CFLAGS += -m64
19 aflags_dwarf := -Wa,-gdwarf-2
20 KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__
21 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
22 KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2
23 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
24 KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
25 KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
26 KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding)
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__
33 export LD_BFD
35 mflags-$(CONFIG_MARCH_Z900) := -march=z900
36 mflags-$(CONFIG_MARCH_Z990) := -march=z990
37 mflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109
38 mflags-$(CONFIG_MARCH_Z10) := -march=z10
39 mflags-$(CONFIG_MARCH_Z196) := -march=z196
40 mflags-$(CONFIG_MARCH_ZEC12) := -march=zEC12
41 mflags-$(CONFIG_MARCH_Z13) := -march=z13
42 mflags-$(CONFIG_MARCH_Z14) := -march=z14
44 export CC_FLAGS_MARCH := $(mflags-y)
46 aflags-y += $(mflags-y)
47 cflags-y += $(mflags-y)
49 cflags-$(CONFIG_MARCH_Z900_TUNE) += -mtune=z900
50 cflags-$(CONFIG_MARCH_Z990_TUNE) += -mtune=z990
51 cflags-$(CONFIG_MARCH_Z9_109_TUNE) += -mtune=z9-109
52 cflags-$(CONFIG_MARCH_Z10_TUNE) += -mtune=z10
53 cflags-$(CONFIG_MARCH_Z196_TUNE) += -mtune=z196
54 cflags-$(CONFIG_MARCH_ZEC12_TUNE) += -mtune=zEC12
55 cflags-$(CONFIG_MARCH_Z13_TUNE) += -mtune=z13
56 cflags-$(CONFIG_MARCH_Z14_TUNE) += -mtune=z14
58 cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
61 # Prevent tail-call optimizations, to get clearer backtraces:
63 cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
65 ifeq ($(call cc-option-yn,-mpacked-stack),y)
66 cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
67 aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
68 endif
70 KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
71 KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
73 ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
74 cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
75 ifneq ($(call cc-option-yn,-mstack-size=8192),y)
76 cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
77 endif
78 endif
80 ifdef CONFIG_WARN_DYNAMIC_STACK
81 ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
82 KBUILD_CFLAGS += -mwarn-dynamicstack
83 KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack
84 endif
85 endif
87 ifdef CONFIG_EXPOLINE
88 ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y)
89 CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
90 CC_FLAGS_EXPOLINE += -mfunction-return=thunk
91 CC_FLAGS_EXPOLINE += -mindirect-branch-table
92 export CC_FLAGS_EXPOLINE
93 cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE
94 aflags-y += -DCC_USING_EXPOLINE
95 endif
96 endif
98 ifdef CONFIG_FUNCTION_TRACER
99 ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n)
100 # make use of hotpatch feature if the compiler supports it
101 cc_hotpatch := -mhotpatch=0,3
102 ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
103 CC_FLAGS_FTRACE := $(cc_hotpatch)
104 KBUILD_AFLAGS += -DCC_USING_HOTPATCH
105 KBUILD_CFLAGS += -DCC_USING_HOTPATCH
106 endif
107 endif
108 endif
110 # Test CFI features of binutils
111 cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
113 KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
114 KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
115 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi)
116 KBUILD_AFLAGS += $(aflags-y) $(cfi)
117 export KBUILD_AFLAGS_DECOMPRESSOR
118 export KBUILD_CFLAGS_DECOMPRESSOR
120 OBJCOPYFLAGS := -O binary
122 head-y := arch/s390/kernel/head64.o
124 # See arch/s390/Kbuild for content of core part of the kernel
125 core-y += arch/s390/
127 libs-y += arch/s390/lib/
128 drivers-y += drivers/s390/
130 # must be linked after kernel
131 drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
133 boot := arch/s390/boot
134 syscalls := arch/s390/kernel/syscalls
135 tools := arch/s390/tools
137 all: bzImage
139 #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
140 KBUILD_IMAGE := $(boot)/bzImage
142 install: vmlinux
143 $(Q)$(MAKE) $(build)=$(boot) $@
145 bzImage: vmlinux
146 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
148 zfcpdump:
149 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
151 vdso_install:
152 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
153 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
155 archclean:
156 $(Q)$(MAKE) $(clean)=$(boot)
157 $(Q)$(MAKE) $(clean)=$(tools)
159 archheaders:
160 $(Q)$(MAKE) $(build)=$(syscalls) uapi
162 archprepare:
163 $(Q)$(MAKE) $(build)=$(syscalls) kapi
164 $(Q)$(MAKE) $(build)=$(tools) kapi
166 # Don't use tabs in echo arguments
167 define archhelp
168 echo '* bzImage - Kernel image for IPL ($(boot)/bzImage)'
169 echo ' install - Install kernel using'
170 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
171 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
172 echo ' install to $$(INSTALL_PATH)'
173 endef