xref: /linux/arch/x86/Makefile.um (revision cf6077e4903ffed2291f5f3cb9d61b29abe456c4)
1# SPDX-License-Identifier: GPL-2.0
2core-y += arch/x86/crypto/
3
4#
5# Disable SSE and other FP/SIMD instructions to match normal x86
6# 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
9#
10ifeq ($(call gcc-min-version, 110000)$(CONFIG_CC_IS_CLANG),y)
11KBUILD_CFLAGS +=  -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
12KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
13endif
14
15KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
16
17# The target.json file is not available when invoking rustc-option, so use the
18# built-in target when checking whether flags are supported instead.
19ifeq ($(CONFIG_X86_32),y)
20KBUILD_RUSTFLAGS_OPTION_CHKS += --target=i686-unknown-linux-gnu
21else
22KBUILD_RUSTFLAGS_OPTION_CHKS += --target=x86_64-unknown-linux-gnu
23endif
24
25ifeq ($(CONFIG_X86_32),y)
26START := 0x8048000
27
28KBUILD_LDFLAGS		+= -m elf_i386
29ELF_ARCH		:= i386
30ELF_FORMAT 		:= elf32-i386
31CHECKFLAGS	+= -D__i386__
32
33KBUILD_CFLAGS		+= $(call cc-option,-m32)
34KBUILD_AFLAGS		+= $(call cc-option,-m32)
35LINK-y			+= $(call cc-option,-m32)
36
37LDS_EXTRA		:= -Ui386
38export LDS_EXTRA
39
40# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
41include $(srctree)/arch/x86/Makefile_32.cpu
42
43# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
44cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
45
46# Prevent sprintf in nfsd from being converted to strcpy and resulting in
47# an unresolved reference.
48cflags-y += -ffreestanding
49
50KBUILD_CFLAGS += $(cflags-y)
51
52else
53
54START := 0x60000000
55
56KBUILD_CFLAGS += -fno-builtin -m64
57
58CHECKFLAGS  += -m64 -D__x86_64__
59KBUILD_AFLAGS += -m64
60KBUILD_LDFLAGS += -m elf_x86_64
61KBUILD_CPPFLAGS += -m64
62
63ELF_ARCH := i386:x86-64
64ELF_FORMAT := elf64-x86-64
65
66# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
67
68LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64
69LINK-y += -m64
70
71vdso-install-y += arch/x86/um/vdso/vdso.so.dbg
72
73endif
74