Blame view

arch/s390/Makefile 5.65 KB
0b73214f8   Greg Kroah-Hartman   s390: add SPDX id...
1
  # SPDX-License-Identifier: GPL-2.0
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
8
9
  #
  # s390/Makefile
  #
  # This file is included by the global makefile so that you can add your own
  # architecture-specific flags and dependencies. Remember to do have actions
  # for "archclean" and "archdep" for cleaning up and making dependencies for
  # this architecture
  #
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
  # Copyright (C) 1994 by Linus Torvalds
  #
1844c9bc0   Martin Schwidefsky   [S390] add suppor...
12
  LD_BFD		:= elf64-s390
d503ac531   Masahiro Yamada   kbuild: rename LD...
13
  KBUILD_LDFLAGS	:= -m elf64_s390
7bdc229fa   Martin Schwidefsky   s390: use -fPIC f...
14
15
  KBUILD_AFLAGS_MODULE += -fPIC
  KBUILD_CFLAGS_MODULE += -fPIC
222d394d3   Sam Ravnborg   kbuild: enable 'm...
16
  KBUILD_AFLAGS	+= -m64
76bf9d6ce   Vasily Gorbik   s390/decompressor...
17
  KBUILD_CFLAGS	+= -m64
805bc0bc2   Gerald Schaefer   s390/kernel: buil...
18
19
20
21
  ifeq ($(CONFIG_RELOCATABLE),y)
  KBUILD_CFLAGS	+= -fPIE
  LDFLAGS_vmlinux	:= -pie
  endif
ee6d777d3   Vasily Gorbik   s390/decompressor...
22
  aflags_dwarf	:= -Wa,-gdwarf-2
96fb54a18   Arnd Bergmann   s390: boot, purga...
23
  KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
ee6d777d3   Vasily Gorbik   s390/decompressor...
24
  KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
96fb54a18   Arnd Bergmann   s390: boot, purga...
25
  KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2
76bf9d6ce   Vasily Gorbik   s390/decompressor...
26
27
28
29
  KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
  KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float
  KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
  KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding)
f9364df30   Heiko Carstens   s390/boot: disabl...
30
  KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
ee6d777d3   Vasily Gorbik   s390/decompressor...
31
32
  KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
  KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
  UTS_MACHINE	:= s390x
9fed920e6   Vasily Gorbik   s390/kasan: incre...
34
  STACK_SIZE	:= $(if $(CONFIG_KASAN),65536,16384)
145167650   Luc Van Oostenryck   kbuild: add endia...
35
  CHECKFLAGS	+= -D__s390__ -D__s390x__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36

1844c9bc0   Martin Schwidefsky   [S390] add suppor...
37
  export LD_BFD
0f1b1ff54   Heiko Carstens   s390: pass march ...
38
39
40
41
42
43
  mflags-$(CONFIG_MARCH_Z900)   := -march=z900
  mflags-$(CONFIG_MARCH_Z990)   := -march=z990
  mflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109
  mflags-$(CONFIG_MARCH_Z10)    := -march=z10
  mflags-$(CONFIG_MARCH_Z196)   := -march=z196
  mflags-$(CONFIG_MARCH_ZEC12)  := -march=zEC12
6997c3236   Martin Schwidefsky   s390: add support...
44
45
  mflags-$(CONFIG_MARCH_Z13)    := -march=z13
  mflags-$(CONFIG_MARCH_Z14)    := -march=z14
a0e225113   Martin Schwidefsky   s390: add support...
46
  mflags-$(CONFIG_MARCH_Z15)    := -march=z15
0f1b1ff54   Heiko Carstens   s390: pass march ...
47

22362a0e2   Martin Schwidefsky   s390/sclp: conver...
48
  export CC_FLAGS_MARCH := $(mflags-y)
0f1b1ff54   Heiko Carstens   s390: pass march ...
49
50
  aflags-y += $(mflags-y)
  cflags-y += $(mflags-y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51

1db9e0513   Heiko Carstens   s390: allow to se...
52
53
54
55
56
57
  cflags-$(CONFIG_MARCH_Z900_TUNE)	+= -mtune=z900
  cflags-$(CONFIG_MARCH_Z990_TUNE)	+= -mtune=z990
  cflags-$(CONFIG_MARCH_Z9_109_TUNE)	+= -mtune=z9-109
  cflags-$(CONFIG_MARCH_Z10_TUNE)		+= -mtune=z10
  cflags-$(CONFIG_MARCH_Z196_TUNE)	+= -mtune=z196
  cflags-$(CONFIG_MARCH_ZEC12_TUNE)	+= -mtune=zEC12
6997c3236   Martin Schwidefsky   s390: add support...
58
59
  cflags-$(CONFIG_MARCH_Z13_TUNE)		+= -mtune=z13
  cflags-$(CONFIG_MARCH_Z14_TUNE)		+= -mtune=z14
a0e225113   Martin Schwidefsky   s390: add support...
60
  cflags-$(CONFIG_MARCH_Z15_TUNE)		+= -mtune=z15
1db9e0513   Heiko Carstens   s390: allow to se...
61

c783b91eb   Martin Schwidefsky   s390: add assembl...
62
  cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
cbbd1fa72   Heiko Carstens   [PATCH] lockdep: ...
63
64
65
66
  #
  # Prevent tail-call optimizations, to get clearer backtraces:
  #
  cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
68c3cc414   Vasily Gorbik   s390: adjust -mpa...
67
  ifeq ($(call cc-option-yn,-mpacked-stack -mbackchain -msoft-float),y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
69
  cflags-$(CONFIG_PACK_STACK)  += -mpacked-stack -D__PACK_STACK
  aflags-$(CONFIG_PACK_STACK)  += -D__PACK_STACK
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
  endif
76bf9d6ce   Vasily Gorbik   s390/decompressor...
71
72
  KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
  KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
  ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
  cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
be7962856   Martin Schwidefsky   [S390] Improved k...
75
  ifneq ($(call cc-option-yn,-mstack-size=8192),y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
77
  cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
  endif
be7962856   Martin Schwidefsky   [S390] Improved k...
78
  endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79

76bf9d6ce   Vasily Gorbik   s390/decompressor...
80
81
82
83
84
  ifdef CONFIG_WARN_DYNAMIC_STACK
    ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
      KBUILD_CFLAGS += -mwarn-dynamicstack
      KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack
    endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
85
  endif
f19fbd5ed   Martin Schwidefsky   s390: introduce e...
86
87
88
89
90
91
  ifdef CONFIG_EXPOLINE
    ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y)
      CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
      CC_FLAGS_EXPOLINE += -mfunction-return=thunk
      CC_FLAGS_EXPOLINE += -mindirect-branch-table
      export CC_FLAGS_EXPOLINE
6e179d641   Martin Schwidefsky   s390: add automat...
92
      cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE
157484abb   Vasily Gorbik   s390: disable asm...
93
      aflags-y += -DCC_USING_EXPOLINE
f19fbd5ed   Martin Schwidefsky   s390: introduce e...
94
95
    endif
  endif
e6d60b368   Heiko Carstens   s390/ftrace: hotp...
96
  ifdef CONFIG_FUNCTION_TRACER
d983c89cc   Vasily Gorbik   s390/ftrace: Add ...
97
98
99
100
101
102
103
104
105
    ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n)
      # make use of hotpatch feature if the compiler supports it
      cc_hotpatch	:= -mhotpatch=0,3
      ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
        CC_FLAGS_FTRACE := $(cc_hotpatch)
        KBUILD_AFLAGS	+= -DCC_USING_HOTPATCH
        KBUILD_CFLAGS	+= -DCC_USING_HOTPATCH
      endif
    endif
e6d60b368   Heiko Carstens   s390/ftrace: hotp...
106
  endif
7bceec4e5   Hendrik Brueckner   s390/vdso: revise...
107
108
109
110
  # Test CFI features of binutils
  cfi := $(call as-instr,.cfi_startproc
  .cfi_val_offset 15$(comma)-160
  .cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
111
  KBUILD_CFLAGS	+= -mbackchain -msoft-float $(cflags-y)
c1afcaec2   Arnd Bergmann   s390: remove -fno...
112
  KBUILD_CFLAGS	+= -pipe -Wno-sign-compare
7bceec4e5   Hendrik Brueckner   s390/vdso: revise...
113
114
  KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables $(cfi)
  KBUILD_AFLAGS	+= $(aflags-y) $(cfi)
76bf9d6ce   Vasily Gorbik   s390/decompressor...
115
116
  export KBUILD_AFLAGS_DECOMPRESSOR
  export KBUILD_CFLAGS_DECOMPRESSOR
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
  
  OBJCOPYFLAGS	:= -O binary
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119

8282cd64d   Vasily Gorbik   s390/boot: make h...
120
  head-y		:= arch/s390/kernel/head64.o
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121

014859430   Heiko Carstens   [S390] standardiz...
122
123
  # See arch/s390/Kbuild for content of core part of the kernel
  core-y		+= arch/s390/
155af2f95   Hans-Joachim Picht   [S390] s390: hibe...
124

4562c9fff   Michael Holzheu   [S390] Replace $(...
125
  libs-y		+= arch/s390/lib/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126
  drivers-y	+= drivers/s390/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
128
129
  
  # must be linked after kernel
  drivers-$(CONFIG_OPROFILE)	+= arch/s390/oprofile/
4562c9fff   Michael Holzheu   [S390] Replace $(...
130
  boot		:= arch/s390/boot
5c75824d9   Hendrik Brueckner   s390/syscalls: ad...
131
  syscalls	:= arch/s390/kernel/syscalls
c30f6828f   Heiko Carstens   s390/facilities: ...
132
  tools		:= arch/s390/tools
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
133

00f2fb573   Vasily Gorbik   s390: remove unco...
134
  all: bzImage
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135

e0aa099c1   Vasily Gorbik   s390: set bzImage...
136
137
  #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg...
  KBUILD_IMAGE	:= $(boot)/bzImage
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138
139
  install: vmlinux
  	$(Q)$(MAKE) $(build)=$(boot) $@
00f2fb573   Vasily Gorbik   s390: remove unco...
140
  bzImage: vmlinux
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
141
  	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
411ed3225   Michael Holzheu   [S390] zfcpdump s...
142
143
  zfcpdump:
  	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
f3cb31e49   Hendrik Brueckner   [S390] vdso: add ...
144
  vdso_install:
f3cb31e49   Hendrik Brueckner   [S390] vdso: add ...
145
  	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
f3cb31e49   Hendrik Brueckner   [S390] vdso: add ...
146
  	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
148
  archclean:
  	$(Q)$(MAKE) $(clean)=$(boot)
c30f6828f   Heiko Carstens   s390/facilities: ...
149
  	$(Q)$(MAKE) $(clean)=$(tools)
5c75824d9   Hendrik Brueckner   s390/syscalls: ad...
150
151
  archheaders:
  	$(Q)$(MAKE) $(build)=$(syscalls) uapi
c30f6828f   Heiko Carstens   s390/facilities: ...
152
  archprepare:
5c75824d9   Hendrik Brueckner   s390/syscalls: ad...
153
  	$(Q)$(MAKE) $(build)=$(syscalls) kapi
7fbf8315f   Hendrik Brueckner   s390/tools: gener...
154
  	$(Q)$(MAKE) $(build)=$(tools) kapi
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
155

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
157
  # Don't use tabs in echo arguments
  define archhelp
00f2fb573   Vasily Gorbik   s390: remove unco...
158
    echo	'* bzImage         - Kernel image for IPL ($(boot)/bzImage)'
b8eecf36a   Michael Holzheu   s390: add 'instal...
159
160
161
162
    echo	'  install         - Install kernel using'
    echo	'                    (your) ~/bin/$(INSTALLKERNEL) or'
    echo	'                    (distribution) /sbin/$(INSTALLKERNEL) or'
    echo	'                    install to $$(INSTALL_PATH)'
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
  endef