diff --git a/repos/libports/lib/import/import-gmp.mk b/repos/libports/lib/import/import-gmp.mk index aabc59d7e..0ca6f3769 100644 --- a/repos/libports/lib/import/import-gmp.mk +++ b/repos/libports/lib/import/import-gmp.mk @@ -9,6 +9,10 @@ ifeq ($(filter-out $(SPECS),arm),) INC_DIR += $(GMP_PORT_DIR)/include/spec/arm endif +ifeq ($(filter-out $(SPECS),arm_64),) + REP_INC_DIR += include/spec/64bit/gmp + INC_DIR += $(GMP_PORT_DIR)/include/spec/arm_64 +endif ifeq ($(filter-out $(SPECS),x86_32),) REP_INC_DIR += include/spec/32bit/gmp INC_DIR += $(GMP_PORT_DIR)/include/spec/x86_32 diff --git a/repos/libports/lib/mk/gmp.inc b/repos/libports/lib/mk/gmp.inc index e0d8ceb1a..f8c15e4b4 100644 --- a/repos/libports/lib/mk/gmp.inc +++ b/repos/libports/lib/mk/gmp.inc @@ -4,7 +4,7 @@ include $(REP_DIR)/lib/import/import-gmp.mk LIBS += libc -CC_OPT += -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP +CC_OPT += -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DCOUNT_LEADING_ZEROS_NEED_CLZ_TAB INC_DIR += $(REP_DIR)/include/gcc INC_DIR += $(GMP_DIR) diff --git a/repos/libports/lib/mk/spec/arm_64/gmp-mpn.mk b/repos/libports/lib/mk/spec/arm_64/gmp-mpn.mk new file mode 100644 index 000000000..3797c6366 --- /dev/null +++ b/repos/libports/lib/mk/spec/arm_64/gmp-mpn.mk @@ -0,0 +1,60 @@ + +GMP_MPN_DIR = $(GMP_DIR)/mpn + +# this file uses the 'sdiv_qrnnd' symbol which is not defined +FILTER_OUT += udiv_w_sdiv.c + +# add ARM-specific assembly files and filter out the generic C files if needed + +SRC_ASM += copyd.asm copyi.asm + +FILTER_OUT += popham.c +FILTER_OUT += logops_n.c sec_div.c sec_pi1_div.c copyi.c copyd.c + +SRC_C += $(notdir $(wildcard $(REP_DIR)/src/lib/gmp/mpn/spec/64bit/*.c)) +SRC_C += $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(GMP_MPN_DIR)/generic/*.c))) + +include $(REP_DIR)/lib/mk/gmp.inc + +PWD := $(shell pwd) + +SRC_O += $(SRC_ASM:.asm=.o) hamdist.o popcount.o + +# +# Create execution environment for the m4-ccas tool, which is used by the gmp +# library to assemble asm files to object files. Make sure to execute this rule +# only from the actual build pass (not when called from 'dep_lib.mk'). This +# way, the 'm4env' gets created within the local build directory of the +# library, not the global build directory. +# +ifeq ($(called_from_lib_mk),yes) +all: m4env +endif + +m4env: + $(VERBOSE)mkdir -p $@/mpn/arm_64 + $(VERBOSE)ln -s $(REP_DIR)/src/lib/gmp/spec/arm_64/config.m4 m4env + $(VERBOSE)ln -s $(GMP_MPN_DIR)/asm-defs.m4 m4env/mpn + +# +# Create object files out of asm files +# +ifneq ($(VERBOSE),) +M4_OUTPUT_FILTER = > /dev/null +endif + +hamdist.o popcount.o: popham.c + $(MSG_COMP)$@ + $(VERBOSE)$(CC) $(CC_DEF) $(CC_C_OPT) -DOPERATION_${@:.o=} $(INCLUDES) -c $< -o $@ + +%.o: %.asm + $(MSG_ASSEM)$@ + $(VERBOSE)cd m4env/mpn; \ + $(GMP_MPN_DIR)/m4-ccas --m4=m4 $(CC) $(CC_MARCH) -std=gnu99 -fPIC -DPIC $(CC_OPT_$*) $(INCLUDES) -c $< -o $(PWD)/$@ \ + $(M4_OUTPUT_FILTER) + +vpath %.c $(REP_DIR)/src/lib/gmp/mpn/spec/64bit +vpath %.c $(GMP_MPN_DIR)/generic +vpath %.asm $(GMP_MPN_DIR)/arm64 + +CC_CXX_WARN_STRICT = diff --git a/repos/libports/ports/gmp.hash b/repos/libports/ports/gmp.hash index 9141bda55..724b0e618 100644 --- a/repos/libports/ports/gmp.hash +++ b/repos/libports/ports/gmp.hash @@ -1 +1 @@ -07b77c4f05fe9aefdbd217f5b42382100f270b62 +855680cf4411a440d5353ea01c55ee6289c67b26 diff --git a/repos/libports/ports/gmp.port b/repos/libports/ports/gmp.port index 8d9f6104c..8115d6c91 100644 --- a/repos/libports/ports/gmp.port +++ b/repos/libports/ports/gmp.port @@ -11,7 +11,8 @@ DIR(gmp) := src/lib/gmp DIRS := include DIR_CONTENT(include) := ${DIR(gmp)}/gmp-impl.h -DIRS += $(addprefix include/spec/, x86_32 x86_64 arm) +DIRS += $(addprefix include/spec/, x86_32 x86_64 arm arm_64) DIR_CONTENT(include/spec/x86_32) := ${DIR(gmp)}/mpn/x86/pentium/gmp-mparam.h DIR_CONTENT(include/spec/x86_64) := ${DIR(gmp)}/mpn/x86_64/gmp-mparam.h DIR_CONTENT(include/spec/arm) := ${DIR(gmp)}/mpn/arm/gmp-mparam.h +DIR_CONTENT(include/spec/arm_64) := ${DIR(gmp)}/mpn/arm64/gmp-mparam.h diff --git a/repos/libports/src/lib/gmp/spec/arm_64/config.m4 b/repos/libports/src/lib/gmp/spec/arm_64/config.m4 new file mode 100644 index 000000000..9913ffbc3 --- /dev/null +++ b/repos/libports/src/lib/gmp/spec/arm_64/config.m4 @@ -0,0 +1,35 @@ +dnl config.m4. Generated automatically by configure. +changequote(<,>) +ifdef(<__CONFIG_M4_INCLUDED__>,,< +define(,<`../.'>) +define(,0) +define(,<`no'>) +define(,) +define(, <.text>) +define(, <.data>) +define(, <:>) +define(, <.globl>) +define(, <>) +define(, <>) +define(, < .section .rodata>) +define(, <.type $1,@$2>) +define(, <.size $1,$2>) +define(, <.L>) +define(, <.long>) +define(,) +define(,<28>) +define(,<30>) +define(,<4>) +define(,64) +define(,0) +define(,eval(GMP_LIMB_BITS-GMP_NAIL_BITS)) +>) +changequote(`,') +ifdef(`__CONFIG_M4_INCLUDED__',,` +include(CONFIG_TOP_SRCDIR`/mpn/asm-defs.m4') +define_not_for_expansion(`HAVE_HOST_CPU_aarch64') +define_not_for_expansion(`HAVE_ABI_64') +define_not_for_expansion(`HAVE_LIMB_LITTLE_ENDIAN') +define_not_for_expansion(`HAVE_DOUBLE_IEEE_LITTLE_ENDIAN') +') +define(`__CONFIG_M4_INCLUDED__')