2 # Loongarch64 system tests
5 LOONGARCH64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/loongarch64/system
6 VPATH+=$(LOONGARCH64_SYSTEM_SRC)
8 # These objects provide the basic boot code and helper functions for all tests
11 LOONGARCH64_TEST_SRCS=$(wildcard $(LOONGARCH64_SYSTEM_SRC)/*.c)
12 LOONGARCH64_TESTS = $(patsubst $(LOONGARCH64_SYSTEM_SRC)/%.c, %, $(LOONGARCH64_TEST_SRCS))
14 CRT_PATH=$(LOONGARCH64_SYSTEM_SRC)
15 LINK_SCRIPT=$(LOONGARCH64_SYSTEM_SRC)/kernel.ld
16 LDFLAGS=-Wl,-T$(LINK_SCRIPT)
17 TESTS+=$(LOONGARCH64_TESTS) $(MULTIARCH_TESTS)
18 CFLAGS+=-nostdlib -g -O1 -march=loongarch64 -mabi=lp64d $(MINILIB_INC)
19 LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
22 .PRECIOUS: $(CRT_OBJS)
25 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@
27 # Build and link the tests
28 %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
29 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
31 memory: CFLAGS+=-DCHECK_UNALIGNED=0
33 QEMU_OPTS+=-serial chardev:output -kernel