STATIC_CODE supports mac

update-fork
MITSUNARI Shigeo 4 years ago
parent 251bf1de3b
commit af1950d8fb
  1. 6
      Makefile
  2. 3
      common.mk
  3. 7
      src/fp_generator.hpp

@ -11,11 +11,12 @@ TEST_SRC+=bls12_test.cpp
TEST_SRC+=mapto_wb19_test.cpp TEST_SRC+=mapto_wb19_test.cpp
TEST_SRC+=ecdsa_c_test.cpp TEST_SRC+=ecdsa_c_test.cpp
TEST_SRC+=modp_test.cpp TEST_SRC+=modp_test.cpp
LIB_OBJ=$(OBJ_DIR)/fp.o
ifeq ($(MCL_STATIC_CODE),1) ifeq ($(MCL_STATIC_CODE),1)
MCL_USE_XBYAK=0 MCL_USE_XBYAK=0
MCL_MAX_BIT_SIZE=384 MCL_MAX_BIT_SIZE=384
CFLAGS+=-DMCL_STATIC_CODE CFLAGS+=-DMCL_STATIC_CODE
LIB_OBJ=obj/static_code.o LIB_OBJ+=obj/static_code.o
TEST_SRC=bls12_test.cpp TEST_SRC=bls12_test.cpp
endif endif
ifeq ($(CPU),x86-64) ifeq ($(CPU),x86-64)
@ -93,7 +94,6 @@ ifneq ($(CPU),)
ASM_SRC=$(ASM_SRC_PATH_NAME).s ASM_SRC=$(ASM_SRC_PATH_NAME).s
endif endif
ASM_OBJ=$(OBJ_DIR)/$(CPU).o ASM_OBJ=$(OBJ_DIR)/$(CPU).o
LIB_OBJ+=$(OBJ_DIR)/fp.o
BN256_OBJ=$(OBJ_DIR)/bn_c256.o BN256_OBJ=$(OBJ_DIR)/bn_c256.o
BN384_OBJ=$(OBJ_DIR)/bn_c384.o BN384_OBJ=$(OBJ_DIR)/bn_c384.o
BN384_256_OBJ=$(OBJ_DIR)/bn_c384_256.o BN384_256_OBJ=$(OBJ_DIR)/bn_c384_256.o
@ -253,7 +253,7 @@ src/static_code.asm: src/dump_code
$< > $@ $< > $@
obj/static_code.o: src/static_code.asm obj/static_code.o: src/static_code.asm
nasm -felf64 -o $@ $< nasm $(NASM_ELF_OPT) -o $@ $<
bin/static_code_test.exe: test/static_code_test.cpp src/fp.cpp obj/static_code.o bin/static_code_test.exe: test/static_code_test.cpp src/fp.cpp obj/static_code.o
$(CXX) -o $@ -O3 $^ -g -DMCL_DONT_USE_XBYAK -DMCL_STATIC_CODE -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -I include -Wall -Wextra $(CXX) -o $@ -O3 $^ -g -DMCL_DONT_USE_XBYAK -DMCL_STATIC_CODE -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -I include -Wall -Wextra

@ -1,11 +1,13 @@
GCC_VER=$(shell $(PRE)$(CC) -dumpversion) GCC_VER=$(shell $(PRE)$(CC) -dumpversion)
UNAME_S=$(shell uname -s) UNAME_S=$(shell uname -s)
NASM_ELF_OPT=-felf64
ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_S),Linux)
OS=Linux OS=Linux
endif endif
ifeq ($(findstring MINGW64,$(UNAME_S)),MINGW64) ifeq ($(findstring MINGW64,$(UNAME_S)),MINGW64)
OS=mingw64 OS=mingw64
CFLAGS+=-D__USE_MINGW_ANSI_STDIO=1 CFLAGS+=-D__USE_MINGW_ANSI_STDIO=1
NASM_ELF_OPT=-fwin64
endif endif
ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN) ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN)
OS=cygwin OS=cygwin
@ -20,6 +22,7 @@ ifeq ($(UNAME_S),Darwin)
GMP_DIR?=/usr/local/opt/gmp GMP_DIR?=/usr/local/opt/gmp
CFLAGS+=-I$(GMP_DIR)/include CFLAGS+=-I$(GMP_DIR)/include
LDFLAGS+=-L$(GMP_DIR)/lib LDFLAGS+=-L$(GMP_DIR)/lib
NASM_ELF_OPT=-fmacho64
else else
LIB_SUF=so LIB_SUF=so
endif endif

@ -65,7 +65,12 @@ void setFuncInfo(DumpCode& prof, const char *suf, const char *name, const T& beg
{ {
if (suf == 0) suf = ""; if (suf == 0) suf = "";
const uint8_t*p = (const uint8_t*)begin; const uint8_t*p = (const uint8_t*)begin;
prof.set(std::string("mclx_") + suf + name, p, end - p); #ifdef __APPLE__
std::string pre = "_mclx_";
#else
std::string pre = "mclx_";
#endif
prof.set(pre + suf + name, p, end - p);
} }
#else #else
template<class T> template<class T>

Loading…
Cancel
Save