1S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
2VPATH+=$(S390X_SRC)
3# EXTFLAGS can be passed by the user, e.g. to override the --accel
4QEMU_OPTS+=-action panic=exit-failure -nographic -serial chardev:output $(EXTFLAGS) -kernel
5LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
6CFLAGS+=-ggdb -O0 -I$(SRC_PATH)/include/hw/s390x/ipl/
7LDFLAGS=-nostdlib -static
8
9%.o: %.S
10	$(CC) -march=z13 -m64 -Wa,--noexecstack -c $< -o $@
11
12%.o: %.c
13	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -march=z13 -m64 -c $< -o $@
14
15%: %.o
16	$(CC) $< -o $@ $(LDFLAGS)
17
18ASM_TESTS =                                                                    \
19    bal                                                                        \
20    cksm                                                                       \
21    clm                                                                        \
22    exrl-ssm-early                                                             \
23    icm                                                                        \
24    sam                                                                        \
25    lpsw                                                                       \
26    lpswe-early                                                                \
27    lra                                                                        \
28    mc                                                                         \
29    per                                                                        \
30    precise-smc-softmmu                                                        \
31    ssm-early                                                                  \
32    stosm-early                                                                \
33    stpq                                                                       \
34    unaligned-lowcore
35
36include $(S390X_SRC)/pgm-specification.mak
37$(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o
38$(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o
39ASM_TESTS += $(PGM_SPECIFICATION_TESTS)
40
41$(ASM_TESTS): LDFLAGS += -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none
42$(ASM_TESTS): $(LINK_SCRIPT)
43TESTS += $(ASM_TESTS)
44
45S390X_MULTIARCH_RUNTIME_OBJS = head64.o console.o $(MINILIB_OBJS)
46$(MULTIARCH_TESTS): $(S390X_MULTIARCH_RUNTIME_OBJS)
47$(MULTIARCH_TESTS): LDFLAGS += $(S390X_MULTIARCH_RUNTIME_OBJS)
48$(MULTIARCH_TESTS): CFLAGS += $(MINILIB_INC)
49memory: CFLAGS += -DCHECK_UNALIGNED=0
50
51# s390x clears the BSS section so we need to account for that
52run-plugin-memory-with-libmem.so: 		\
53	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py \
54		--bss-cleared $@.out
55