blob: a46b1397ad01c2124b1a1785510600379eda0d0c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Al Viro5c48b102011-08-18 20:06:39 +01002core-y += arch/x86/crypto/
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
David Gow88498182022-12-17 12:44:35 +08004#
5# Disable SSE and other FP/SIMD instructions to match normal x86
David Gowa3046a62023-03-18 12:15:54 +08006# This is required to work around issues in older LLVM versions, but breaks
7# GCC versions < 11. See:
8# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652
David Gow88498182022-12-17 12:44:35 +08009#
David Gowa3046a62023-03-18 12:15:54 +080010ifeq ($(CONFIG_CC_IS_CLANG),y)
David Gow88498182022-12-17 12:44:35 +080011KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
David Gow9a2123b2024-05-29 17:33:35 +080012KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
David Gow88498182022-12-17 12:44:35 +080013KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
David Gowa3046a62023-03-18 12:15:54 +080014endif
David Gow88498182022-12-17 12:44:35 +080015
Al Viro7bbe7202011-08-18 20:06:29 +010016ifeq ($(CONFIG_X86_32),y)
Jeff Dike42fda662007-10-16 01:26:50 -070017START := 0x8048000
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Masahiro Yamadad503ac52018-08-24 08:20:39 +090019KBUILD_LDFLAGS += -m elf_i386
Al Viroa6e77d62011-08-18 20:06:19 +010020ELF_ARCH := i386
21ELF_FORMAT := elf32-i386
Al Viroca5cd872007-10-29 04:31:16 +000022CHECKFLAGS += -D__i386__
Paolo 'Blaisorblade' Giarrusso20d00212005-07-14 00:33:43 -070023
Sam Ravnborga0f97e02007-10-14 22:21:35 +020024KBUILD_CFLAGS += $(call cc-option,-m32)
Sam Ravnborg222d3942007-10-15 21:59:31 +020025KBUILD_AFLAGS += $(call cc-option,-m32)
Paolo 'Blaisorblade' Giarrusso20d00212005-07-14 00:33:43 -070026LINK-y += $(call cc-option,-m32)
Paolo 'Blaisorblade' Giarrusso20d00212005-07-14 00:33:43 -070027
Al Viro3cb42092012-04-09 13:59:00 -040028LDS_EXTRA := -Ui386
29export LDS_EXTRA
30
Paolo 'Blaisorblade' Giarrusso96d55b82005-10-30 15:00:07 -080031# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
Masahiro Yamada67d7c302023-01-28 18:24:23 +090032include $(srctree)/arch/x86/Makefile_32.cpu
Paolo 'Blaisorblade' Giarrusso96d55b82005-10-30 15:00:07 -080033
34# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
35cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
36
Jeff Dikefec468b2006-06-04 02:51:49 -070037# Prevent sprintf in nfsd from being converted to strcpy and resulting in
38# an unresolved reference.
39cflags-y += -ffreestanding
40
Sam Ravnborga0f97e02007-10-14 22:21:35 +020041KBUILD_CFLAGS += $(cflags-y)
Al Viro7bbe7202011-08-18 20:06:29 +010042
43else
44
45START := 0x60000000
46
47KBUILD_CFLAGS += -fno-builtin -m64
48
49CHECKFLAGS += -m64 -D__x86_64__
50KBUILD_AFLAGS += -m64
Masahiro Yamadad503ac52018-08-24 08:20:39 +090051KBUILD_LDFLAGS += -m elf_x86_64
Al Viro7bbe7202011-08-18 20:06:29 +010052KBUILD_CPPFLAGS += -m64
53
54ELF_ARCH := i386:x86-64
55ELF_FORMAT := elf64-x86-64
56
57# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
58
Johannes Berg386093c2021-03-08 14:02:37 +010059LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64
Al Viro7bbe7202011-08-18 20:06:29 +010060LINK-y += -m64
61
Al Viro7bbe7202011-08-18 20:06:29 +010062endif