Makefile (85a0b791bc17f7a49280b33e2905d109c062a47b) Makefile (d983c89cc96a87db0c00821e81aa3d8296c12225)
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
13LD_BFD := elf64-s390
14LDFLAGS := -m elf64_s390
15KBUILD_AFLAGS_MODULE += -fPIC
16KBUILD_CFLAGS_MODULE += -fPIC
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
13LD_BFD := elf64-s390
14LDFLAGS := -m elf64_s390
15KBUILD_AFLAGS_MODULE += -fPIC
16KBUILD_CFLAGS_MODULE += -fPIC
17KBUILD_AFLAGS += -m64
18KBUILD_CFLAGS += -m64
17KBUILD_CFLAGS += -m64
19aflags_dwarf := -Wa,-gdwarf-2
20KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__
21KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
22KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2
23KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
24KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
25KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
26KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding)
27KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
28KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
18KBUILD_AFLAGS += -m64
29UTS_MACHINE := s390x
30STACK_SIZE := 16384
31CHECKFLAGS += -D__s390__ -D__s390x__
32
33export LD_BFD
34
35mflags-$(CONFIG_MARCH_Z900) := -march=z900
36mflags-$(CONFIG_MARCH_Z990) := -march=z990

--- 20 unchanged lines hidden (view full) ---

57
58cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
59
60#
61# Prevent tail-call optimizations, to get clearer backtraces:
62#
63cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
64
19UTS_MACHINE := s390x
20STACK_SIZE := 16384
21CHECKFLAGS += -D__s390__ -D__s390x__
22
23export LD_BFD
24
25mflags-$(CONFIG_MARCH_Z900) := -march=z900
26mflags-$(CONFIG_MARCH_Z990) := -march=z990

--- 20 unchanged lines hidden (view full) ---

47
48cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
49
50#
51# Prevent tail-call optimizations, to get clearer backtraces:
52#
53cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
54
55# old style option for packed stacks
56ifeq ($(call cc-option-yn,-mkernel-backchain),y)
57cflags-$(CONFIG_PACK_STACK) += -mkernel-backchain -D__PACK_STACK
58aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
59endif
60
61# new style option for packed stacks
65ifeq ($(call cc-option-yn,-mpacked-stack),y)
66cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
67aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
68endif
69
62ifeq ($(call cc-option-yn,-mpacked-stack),y)
63cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
64aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
65endif
66
70KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
71KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
72
73ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
74cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
75ifneq ($(call cc-option-yn,-mstack-size=8192),y)
76cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
77endif
78endif
79
67ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
68cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
69ifneq ($(call cc-option-yn,-mstack-size=8192),y)
70cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
71endif
72endif
73
80ifdef 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
74ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
75cflags-$(CONFIG_WARN_DYNAMIC_STACK) += -mwarn-dynamicstack
85endif
86
87ifdef 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
76endif
77
78ifdef CONFIG_EXPOLINE
79 ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y)
80 CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
81 CC_FLAGS_EXPOLINE += -mfunction-return=thunk
82 CC_FLAGS_EXPOLINE += -mindirect-branch-table
83 export CC_FLAGS_EXPOLINE
84 cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE
94 aflags-y += -DCC_USING_EXPOLINE
95 endif
96endif
97
98ifdef CONFIG_FUNCTION_TRACER
85 endif
86endif
87
88ifdef CONFIG_FUNCTION_TRACER
99# make use of hotpatch feature if the compiler supports it
100cc_hotpatch := -mhotpatch=0,3
101ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
102CC_FLAGS_FTRACE := $(cc_hotpatch)
103KBUILD_AFLAGS += -DCC_USING_HOTPATCH
104KBUILD_CFLAGS += -DCC_USING_HOTPATCH
89 ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n)
90 # make use of hotpatch feature if the compiler supports it
91 cc_hotpatch := -mhotpatch=0,3
92 ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
93 CC_FLAGS_FTRACE := $(cc_hotpatch)
94 KBUILD_AFLAGS += -DCC_USING_HOTPATCH
95 KBUILD_CFLAGS += -DCC_USING_HOTPATCH
96 endif
97 endif
105endif
98endif
106endif
107
108# Test CFI features of binutils
109cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
110
111KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
112KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
113KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi)
114KBUILD_AFLAGS += $(aflags-y) $(cfi)
99
100# Test CFI features of binutils
101cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
102
103KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
104KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
105KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi)
106KBUILD_AFLAGS += $(aflags-y) $(cfi)
115export KBUILD_AFLAGS_DECOMPRESSOR
116export KBUILD_CFLAGS_DECOMPRESSOR
117
118OBJCOPYFLAGS := -O binary
119
107
108OBJCOPYFLAGS := -O binary
109
120head-y := arch/s390/kernel/head64.o
110head-y := arch/s390/kernel/head.o
111head-y += arch/s390/kernel/head64.o
121
122# See arch/s390/Kbuild for content of core part of the kernel
123core-y += arch/s390/
124
125libs-y += arch/s390/lib/
126drivers-y += drivers/s390/
127
128# must be linked after kernel
129drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
130
131boot := arch/s390/boot
132syscalls := arch/s390/kernel/syscalls
133tools := arch/s390/tools
134
112
113# See arch/s390/Kbuild for content of core part of the kernel
114core-y += arch/s390/
115
116libs-y += arch/s390/lib/
117drivers-y += drivers/s390/
118
119# must be linked after kernel
120drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
121
122boot := arch/s390/boot
123syscalls := arch/s390/kernel/syscalls
124tools := arch/s390/tools
125
135all: bzImage
126all: image bzImage
136
137#KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
138KBUILD_IMAGE := $(boot)/bzImage
139
140install: vmlinux
141 $(Q)$(MAKE) $(build)=$(boot) $@
142
127
128#KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
129KBUILD_IMAGE := $(boot)/bzImage
130
131install: vmlinux
132 $(Q)$(MAKE) $(build)=$(boot) $@
133
143bzImage: vmlinux
134image bzImage: vmlinux
144 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
145
146zfcpdump:
147 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
148
149vdso_install:
150 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
151 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@

--- 6 unchanged lines hidden (view full) ---

158 $(Q)$(MAKE) $(build)=$(syscalls) uapi
159
160archprepare:
161 $(Q)$(MAKE) $(build)=$(syscalls) kapi
162 $(Q)$(MAKE) $(build)=$(tools) kapi
163
164# Don't use tabs in echo arguments
165define archhelp
135 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
136
137zfcpdump:
138 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
139
140vdso_install:
141 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
142 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@

--- 6 unchanged lines hidden (view full) ---

149 $(Q)$(MAKE) $(build)=$(syscalls) uapi
150
151archprepare:
152 $(Q)$(MAKE) $(build)=$(syscalls) kapi
153 $(Q)$(MAKE) $(build)=$(tools) kapi
154
155# Don't use tabs in echo arguments
156define archhelp
166 echo '* bzImage - Kernel image for IPL ($(boot)/bzImage)'
157 echo '* image - Kernel image for IPL ($(boot)/image)'
158 echo '* bzImage - Compressed kernel image for IPL ($(boot)/bzImage)'
167 echo ' install - Install kernel using'
168 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
169 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
170 echo ' install to $$(INSTALL_PATH)'
171endef
159 echo ' install - Install kernel using'
160 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
161 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
162 echo ' install to $$(INSTALL_PATH)'
163endef