1# i386 cross compile notes 2 3I386_SRC=$(SRC_PATH)/tests/tcg/i386 4 5# Set search path for all sources 6VPATH += $(I386_SRC) 7 8I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c)) 9ALL_X86_TESTS=$(I386_SRCS:.c=) 10SKIP_I386_TESTS=test-i386-ssse3 test-avx 11X86_64_TESTS:=$(filter test-i386-bmi2 test-i386-ssse3 test-avx, $(ALL_X86_TESTS)) 12 13test-i386-sse-exceptions: CFLAGS += -msse4.1 -mfpmath=sse 14run-test-i386-sse-exceptions: QEMU_OPTS += -cpu max 15run-plugin-test-i386-sse-exceptions-%: QEMU_OPTS += -cpu max 16 17test-i386-pcmpistri: CFLAGS += -msse4.2 18run-test-i386-pcmpistri: QEMU_OPTS += -cpu max 19run-plugin-test-i386-pcmpistri-%: QEMU_OPTS += -cpu max 20 21test-i386-bmi2: CFLAGS=-O2 22run-test-i386-bmi2: QEMU_OPTS += -cpu max 23run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max 24 25# 26# hello-i386 is a barebones app 27# 28hello-i386: CFLAGS+=-ffreestanding 29hello-i386: LDFLAGS+=-nostdlib 30 31# test-386 includes a couple of additional objects that need to be 32# linked together, we also need a no-pie capable compiler due to the 33# non-pic calls into 16-bit mode 34ifneq ($(CROSS_CC_HAS_I386_NOPIE),) 35test-i386: CFLAGS += -fno-pie 36 37test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h 38 $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ \ 39 $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm 40else 41test-i386: 42 $(call skip-test, "BUILD of $@", "missing -no-pie compiler support") 43run-test-i386: 44 $(call skip-test, "RUN of test-i386", "not built") 45run-plugin-test-i386-with-%: 46 $(call skip-test, "RUN of test-i386 ($*)", "not built") 47endif 48 49ifeq ($(SPEED), slow) 50 51test-i386-fprem.ref: test-i386-fprem 52 $(call quiet-command, ./$< > $@,"GENREF","generating $@") 53 54run-test-i386-fprem: TIMEOUT=60 55run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref 56 $(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)") 57 $(call diff-out,test-i386-fprem, test-i386-fprem.ref) 58else 59SKIP_I386_TESTS+=test-i386-fprem 60endif 61 62# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so 63run-plugin-%-with-libinsn.so: 64 $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ 65 -plugin ../../plugin/libinsn.so$(COMMA)inline=on \ 66 -d plugin -D $*-with-libinsn.so.pout $*, \ 67 "$* (inline) on $(TARGET_NAME)") 68 69# Update TESTS 70I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) 71TESTS=$(MULTIARCH_TESTS) $(I386_TESTS) 72 73# On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack) 74EXTRA_RUNS+=run-test-mmap-4096 75 76sha512-sse: CFLAGS=-msse4.1 -O3 77sha512-sse: sha512.c 78 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) 79 80run-sha512-sse: QEMU_OPTS+=-cpu max 81run-plugin-sha512-sse-with-%: QEMU_OPTS+=-cpu max 82 83TESTS+=sha512-sse 84 85CLEANFILES += test-avx.h 86test-avx.h: test-avx.py x86.csv 87 $(PYTHON) $(I386_SRC)/test-avx.py $(I386_SRC)/x86.csv $@ 88 89test-avx: CFLAGS += -masm=intel -O -I. 90test-avx: test-avx.h 91