]> git.ipfire.org Git - people/arne_f/kernel.git/blame - tools/testing/selftests/x86/Makefile
Merge branch 'WIP.x86/boot' into x86/boot, to pick up ready branch
[people/arne_f/kernel.git] / tools / testing / selftests / x86 / Makefile
CommitLineData
e9886ace
AL
1all:
2
3include ../lib.mk
4
5.PHONY: all all_32 all_64 warn_32bit_failure clean
3f705dfd 6
f80fd3a5 7TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall test_mremap_vdso \
0eb1d0fa 8 check_initial_reg_state sigreturn ldt_gdt iopl mpx-mini-test ioperm \
3200ca80 9 protection_keys test_vdso
6c25da5a 10TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \
0f672809 11 test_FCMOV test_FCOMI test_FISTTP \
65cacec1 12 vdso_restorer
66060214 13TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip
3f705dfd 14
c2affbf9 15TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY)
c31b3425 16TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
c2affbf9 17BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
c31b3425 18BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
3f705dfd 19
a8ba798b 20BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
21BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
22
3f705dfd
AL
23CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
24
f9ea4a33 25UNAME_M := $(shell uname -m)
e9886ace
AL
26CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
27CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
3f705dfd 28
e9886ace 29ifeq ($(CAN_BUILD_I386),1)
3f705dfd 30all: all_32
c1e6e5cb 31TEST_PROGS += $(BINARIES_32)
e9886ace
AL
32endif
33
34ifeq ($(CAN_BUILD_X86_64),1)
3f705dfd 35all: all_64
07620abe 36TEST_PROGS += $(BINARIES_64)
3f705dfd
AL
37endif
38
e9886ace 39all_32: $(BINARIES_32)
3f705dfd
AL
40
41all_64: $(BINARIES_64)
42
43clean:
44 $(RM) $(BINARIES_32) $(BINARIES_64)
45
a8ba798b 46$(BINARIES_32): $(OUTPUT)/%_32: %.c
57ca6897 47 $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm
3f705dfd 48
a8ba798b 49$(BINARIES_64): $(OUTPUT)/%_64: %.c
3f705dfd
AL
50 $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
51
e9886ace
AL
52# x86_64 users should be encouraged to install 32-bit libraries
53ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),01)
54all: warn_32bit_failure
55
56warn_32bit_failure:
57 @echo "Warning: you seem to have a broken 32-bit build" 2>&1; \
58 echo "environment. This will reduce test coverage of 64-bit" 2>&1; \
59 echo "kernels. If you are using a Debian-like distribution," 2>&1; \
60 echo "try:"; 2>&1; \
61 echo ""; \
62 echo " apt-get install gcc-multilib libc6-i386 libc6-dev-i386"; \
63 echo ""; \
64 echo "If you are using a Fedora-like distribution, try:"; \
65 echo ""; \
66 echo " yum install glibc-devel.*i686"; \
67 exit 0;
68endif
e22438f8
AL
69
70# Some tests have additional dependencies.
a8ba798b 71$(OUTPUT)/sysret_ss_attrs_64: thunks.S
72$(OUTPUT)/ptrace_syscall_32: raw_syscall_helper_32.S
73$(OUTPUT)/test_syscall_vdso_32: thunks_32.S
e21d50f3
AL
74
75# check_initial_reg_state is special: it needs a custom entry, and it
76# needs to be static so that its interpreter doesn't destroy its initial
77# state.
a8ba798b 78$(OUTPUT)/check_initial_reg_state_32: CFLAGS += -Wl,-ereal_start -static
79$(OUTPUT)/check_initial_reg_state_64: CFLAGS += -Wl,-ereal_start -static