.. | .. |
---|
31 | 31 | CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h |
---|
32 | 32 | M16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS)) |
---|
33 | 33 | |
---|
34 | | -REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \ |
---|
| 34 | +REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ |
---|
35 | 35 | -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ |
---|
36 | 36 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ |
---|
37 | 37 | -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) |
---|
38 | 38 | |
---|
39 | | -REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) |
---|
40 | | -REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) |
---|
| 39 | +REALMODE_CFLAGS += -ffreestanding |
---|
| 40 | +REALMODE_CFLAGS += -fno-stack-protector |
---|
41 | 41 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -Wno-address-of-packed-member) |
---|
42 | 42 | REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) |
---|
43 | 43 | REALMODE_CFLAGS += $(CLANG_FLAGS) |
---|
.. | .. |
---|
47 | 47 | # and a 64 bit version to simplify shared Makefiles. |
---|
48 | 48 | # e.g.: obj-y += foo_$(BITS).o |
---|
49 | 49 | export BITS |
---|
50 | | - |
---|
51 | | -ifdef CONFIG_X86_NEED_RELOCS |
---|
52 | | - LDFLAGS_vmlinux := --emit-relocs --discard-none |
---|
53 | | -endif |
---|
54 | 50 | |
---|
55 | 51 | # |
---|
56 | 52 | # Prevent GCC from generating any FP code by mistake. |
---|
.. | .. |
---|
135 | 131 | |
---|
136 | 132 | KBUILD_CFLAGS += -mno-red-zone |
---|
137 | 133 | KBUILD_CFLAGS += -mcmodel=kernel |
---|
138 | | - |
---|
139 | | - # -funit-at-a-time shrinks the kernel .text considerably |
---|
140 | | - # unfortunately it makes reading oopses harder. |
---|
141 | | - KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) |
---|
142 | 134 | endif |
---|
143 | 135 | |
---|
144 | 136 | ifdef CONFIG_X86_X32 |
---|
.. | .. |
---|
185 | 177 | KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) |
---|
186 | 178 | endif |
---|
187 | 179 | |
---|
188 | | -# Stackpointer is addressed different for 32 bit and 64 bit x86 |
---|
189 | | -sp-$(CONFIG_X86_32) := esp |
---|
190 | | -sp-$(CONFIG_X86_64) := rsp |
---|
191 | | - |
---|
192 | | -# do binutils support CFI? |
---|
193 | | -cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) |
---|
194 | | -# is .cfi_signal_frame supported too? |
---|
195 | | -cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) |
---|
196 | | -cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) |
---|
197 | | - |
---|
198 | | -# does binutils support specific instructions? |
---|
199 | | -asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) |
---|
200 | | -asinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1) |
---|
201 | | -asinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1) |
---|
202 | | -avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) |
---|
203 | | -avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) |
---|
204 | | -avx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1) |
---|
205 | | -sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1) |
---|
206 | | -sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) |
---|
207 | | -adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1) |
---|
208 | | - |
---|
209 | | -KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) |
---|
210 | | -KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) |
---|
211 | | - |
---|
212 | | -KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) |
---|
213 | | - |
---|
214 | | -# |
---|
215 | | -# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to |
---|
216 | | -# the linker to force 2MB page size regardless of the default page size used |
---|
217 | | -# by the linker. |
---|
218 | | -# |
---|
219 | | -ifdef CONFIG_X86_64 |
---|
220 | | -KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000) |
---|
221 | | -endif |
---|
222 | | - |
---|
223 | | -ifdef CONFIG_LTO_CLANG |
---|
224 | | -ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) |
---|
225 | | -KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) |
---|
226 | | -endif |
---|
227 | | -endif |
---|
228 | | - |
---|
229 | | -# Speed up the build |
---|
230 | | -KBUILD_CFLAGS += -pipe |
---|
231 | 180 | # Workaround for a gcc prelease that unfortunately was shipped in a suse release |
---|
232 | 181 | KBUILD_CFLAGS += -Wno-sign-compare |
---|
233 | 182 | # |
---|
.. | .. |
---|
246 | 195 | KBUILD_CFLAGS += $(call cc-option,-fno-jump-tables) |
---|
247 | 196 | endif |
---|
248 | 197 | endif |
---|
| 198 | + |
---|
| 199 | +ifdef CONFIG_SLS |
---|
| 200 | + KBUILD_CFLAGS += -mharden-sls=all |
---|
| 201 | +endif |
---|
| 202 | + |
---|
| 203 | +KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE) |
---|
| 204 | + |
---|
| 205 | +ifdef CONFIG_LTO_CLANG |
---|
| 206 | +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) |
---|
| 207 | +KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) |
---|
| 208 | +endif |
---|
| 209 | +endif |
---|
| 210 | + |
---|
| 211 | +ifdef CONFIG_X86_NEED_RELOCS |
---|
| 212 | +LDFLAGS_vmlinux := --emit-relocs --discard-none |
---|
| 213 | +else |
---|
| 214 | +LDFLAGS_vmlinux := |
---|
| 215 | +endif |
---|
| 216 | + |
---|
| 217 | +# |
---|
| 218 | +# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to |
---|
| 219 | +# the linker to force 2MB page size regardless of the default page size used |
---|
| 220 | +# by the linker. |
---|
| 221 | +# |
---|
| 222 | +ifdef CONFIG_X86_64 |
---|
| 223 | +LDFLAGS_vmlinux += -z max-page-size=0x200000 |
---|
| 224 | +endif |
---|
| 225 | + |
---|
249 | 226 | |
---|
250 | 227 | archscripts: scripts_basic |
---|
251 | 228 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs |
---|
.. | .. |
---|
286 | 263 | |
---|
287 | 264 | boot := arch/x86/boot |
---|
288 | 265 | |
---|
289 | | -BOOT_TARGETS = bzlilo bzdisk fdimage fdimage144 fdimage288 isoimage |
---|
| 266 | +BOOT_TARGETS = bzdisk fdimage fdimage144 fdimage288 isoimage |
---|
290 | 267 | |
---|
291 | 268 | PHONY += bzImage $(BOOT_TARGETS) |
---|
292 | 269 | |
---|
| 270 | +# Don't compile Image in mixed build with "all" target |
---|
| 271 | +ifndef KBUILD_MIXED_TREE |
---|
293 | 272 | # Default kernel to build |
---|
294 | 273 | all: bzImage |
---|
| 274 | +endif |
---|
295 | 275 | |
---|
296 | 276 | # KBUILD_IMAGE specify target image being built |
---|
297 | 277 | KBUILD_IMAGE := $(boot)/bzImage |
---|
.. | .. |
---|
307 | 287 | $(BOOT_TARGETS): vmlinux |
---|
308 | 288 | $(Q)$(MAKE) $(build)=$(boot) $@ |
---|
309 | 289 | |
---|
310 | | -PHONY += install |
---|
311 | | -install: |
---|
| 290 | +PHONY += install bzlilo |
---|
| 291 | +install bzlilo: |
---|
312 | 292 | $(Q)$(MAKE) $(build)=$(boot) $@ |
---|
313 | 293 | |
---|
314 | 294 | PHONY += vdso_install |
---|
.. | .. |
---|
317 | 297 | |
---|
318 | 298 | archprepare: checkbin |
---|
319 | 299 | checkbin: |
---|
| 300 | +ifndef CONFIG_CC_HAS_ASM_GOTO |
---|
| 301 | + @echo Compiler lacks asm-goto support. |
---|
| 302 | + @exit 1 |
---|
| 303 | +endif |
---|
320 | 304 | ifdef CONFIG_RETPOLINE |
---|
321 | 305 | ifeq ($(RETPOLINE_CFLAGS),) |
---|
322 | 306 | @echo "You are building kernel with non-retpoline compiler." >&2 |
---|