diff options
author | MITSUNARI Shigeo <[email protected]> | 2020-05-10 14:20:11 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2020-05-10 14:43:38 +0900 |
commit | 2f6d9e3450fa5cc7fdf560dab9ed984c04997886 (patch) | |
tree | 08d8a2468f3458116c019300026aaaf18eb592cc | |
parent | a7d10a1e4a177b6b5c86134f6a19a2ee49042ecb (diff) | |
download | xbyak-2f6d9e3450fa5cc7fdf560dab9ed984c04997886.tar.gz xbyak-2f6d9e3450fa5cc7fdf560dab9ed984c04997886.zip |
fix test for mac
-rw-r--r-- | sample/Makefile | 18 | ||||
-rw-r--r-- | test/Makefile | 21 | ||||
-rw-r--r-- | test/jmp.cpp | 9 |
3 files changed, 39 insertions, 9 deletions
diff --git a/sample/Makefile b/sample/Makefile index 84a7f87..0c100a3 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -1,10 +1,12 @@ -TARGET = test quantize bf toyvm test_util memfunc static_buf jmp_table XBYAK_INC=../xbyak/xbyak.h BOOST_EXIST=$(shell echo "\#include <boost/spirit/core.hpp>" | (gcc -E - 2>/dev/null) | grep "boost/spirit/core.hpp" >/dev/null && echo "1") UNAME_M=$(shell uname -m) +ONLY_64BIT=0 ifeq ($(shell uname -s),Darwin) + ONLY_64BIT=1 + OS=mac ifeq ($(UNAME_M),x86_64) BIT=64 endif @@ -27,19 +29,27 @@ else endif ifeq ($(BIT),64) -TARGET += test64 bf64 memfunc64 test_util64 static_buf64 jmp_table64 +TARGET += test64 bf64 memfunc64 test_util64 jmp_table64 ifeq ($(BOOST_EXIST),1) TARGET += calc64 #calc2_64 endif endif +ifneq ($(OS),mac) +TARGET += static_buf64 +endif + + +ifneq ($(ONLY_64BIT),1) + TARGET += test quantize bf toyvm test_util memfunc static_buf jmp_table ifeq ($(BOOST_EXIST),1) -TARGET += calc #calc2 + TARGET += calc #calc2 +endif endif all: $(TARGET) -CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -pedantic +CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith #-pedantic CFLAGS=-g -O2 -fomit-frame-pointer -Wall -I../ $(CFLAGS_WARN) diff --git a/test/Makefile b/test/Makefile index dea57e2..edce942 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,9 +1,18 @@ -TARGET = make_nm normalize_prefix jmp address bad_address misc cvt_test cvt_test32 +TARGET = make_nm normalize_prefix bad_address misc cvt_test cvt_test32 XBYAK_INC=../xbyak/xbyak.h +UNAME_S=$(shell uname -s) BIT=32 ifeq ($(shell uname -m),x86_64) BIT=64 endif +ONLY_64BIT=0 +ifeq ($(UNAME_S),Darwin) + # 32-bit binary is not supported + ONLY_64BIT=1 +endif +ifeq ($(ONLY_64BIT),0) + TARGET += jmp address +endif ifeq ($(BIT),64) TARGET += jmp64 address64 @@ -37,17 +46,19 @@ cvt_test: cvt_test.cpp ../xbyak/xbyak.h cvt_test32: cvt_test.cpp ../xbyak/xbyak.h $(CXX) $(CFLAGS) $< -o $@ -DXBYAK32 -test_nm: normalize_prefix jmp bad_address $(TARGET) +test_nm: normalize_prefix $(TARGET) $(MAKE) -C ../gen +ifneq ($(ONLY_64BIT),1) ./test_nm.sh ./test_nm.sh Y ./test_nm.sh avx512 ./test_address.sh ./jmp + ./cvt_test32 +endif ./bad_address ./misc ./cvt_test - ./cvt_test32 ifeq ($(BIT),64) ./test_address.sh 64 ./test_nm.sh 64 @@ -56,8 +67,10 @@ ifeq ($(BIT),64) endif test_avx: normalize_prefix +ifneq ($(ONLY_64BIT),0) ./test_avx.sh ./test_avx.sh Y +endif ifeq ($(BIT),64) ./test_address.sh 64 ./test_avx.sh 64 @@ -65,7 +78,9 @@ ifeq ($(BIT),64) endif test_avx512: normalize_prefix +ifneq ($(ONLY_64BIT),0) ./test_avx512.sh +endif ifeq ($(BIT),64) ./test_avx512.sh 64 endif diff --git a/test/jmp.cpp b/test/jmp.cpp index 3afc773..9d9bdf3 100644 --- a/test/jmp.cpp +++ b/test/jmp.cpp @@ -428,6 +428,7 @@ CYBOZU_TEST_AUTO(test4) } } +#ifndef __APPLE__ CYBOZU_TEST_AUTO(test5) { struct Test5 : Xbyak::CodeGenerator { @@ -475,6 +476,7 @@ CYBOZU_TEST_AUTO(test5) gm.assign((const char*)gc.getCode(), gc.getSize()); CYBOZU_TEST_EQUAL(fm, gm); } +#endif size_t getValue(const uint8* p) { @@ -1217,11 +1219,11 @@ CYBOZU_TEST_AUTO(rip_jmp) CYBOZU_TEST_EQUAL(ret, ret1234() + ret9999()); } -#ifdef XBYAK64_GCC +#if 0 CYBOZU_TEST_AUTO(rip_addr) { /* - assume |&x - &code| < 2GiB + we can't assume |&x - &code| < 2GiB anymore */ static int x = 5; struct Code : Xbyak::CodeGenerator { @@ -1236,6 +1238,8 @@ CYBOZU_TEST_AUTO(rip_addr) CYBOZU_TEST_EQUAL(x, 123); } #endif + +#ifndef __APPLE__ CYBOZU_TEST_AUTO(rip_addr_with_fixed_buf) { MIE_ALIGN(4096) static char buf[8192]; @@ -1260,6 +1264,7 @@ CYBOZU_TEST_AUTO(rip_addr_with_fixed_buf) code.setProtectModeRW(); } #endif +#endif struct ReleaseTestCode : Xbyak::CodeGenerator { ReleaseTestCode(Label& L1, Label& L2, Label& L3) |