diff --git a/repos/libports/lib/mk/libm.inc b/repos/libports/lib/mk/libm.inc new file mode 100644 index 000000000..4ba2b1257 --- /dev/null +++ b/repos/libports/lib/mk/libm.inc @@ -0,0 +1,55 @@ +PORT_DIR := $(call select_from_ports,openlibm) + +# Depot hack +ifneq ($(PORT_DIR),) +LIBM_PORT_DIR = $(PORT_DIR)/ +endif + +LIBM_SRC_DIR := $(LIBM_PORT_DIR)src/lib/openlibm + +SHARED_LIB = yes +LIBS += libc + +CC_OPT += -fno-gnu89-inline +CC_OPT += -std=c99 -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration + +CC_OPT += -include sys/cdefs.h + +INC_DIR += $(REP_DIR)/include/openlibm +INC_DIR += $(LIBM_SRC_DIR) +INC_DIR += $(LIBM_SRC_DIR)/src +INC_DIR += $(LIBM_PORT_DIR)include/openlibm +INC_DIR += $(LIBM_SRC_DIR)/include + +SUBDIRS = src $(ARCH) bsdsrc +# Add ld80 directory on x86 and x64 +ifneq ($(filter $(ARCH),i387 amd64),) +SUBDIRS += ld80 +else +ifneq ($(filter $(ARCH),aarch64),) +SUBDIRS += ld128 +else +endif +endif + +define INC_template +TEST=test +override CUR_SRCS = $(1)_SRCS +-include $(LIBM_SRC_DIR)/$(1)/Make.files +SRCS += $$(addprefix $(1)/,$$($(1)_SRCS)) +endef + +$(foreach dir,$(SUBDIRS),$(eval $(call INC_template,$(dir)))) + +DUPLICATE_NAMES = $(filter $(patsubst %.S,%,$($(ARCH)_SRCS)),$(patsubst %.c,%,$(src_SRCS))) +DUPLICATE_SRCS = $(addsuffix .c,$(DUPLICATE_NAMES)) + +CLEAN_SRCS = $(filter-out $(DUPLICATE_SRCS),$(notdir $(SRCS))) + +SRC_C += $(filter %.c,$(CLEAN_SRCS)) +SRC_S += $(filter %.S,$(CLEAN_SRCS)) + +$(foreach dir,$(SUBDIRS),$(eval vpath %.c $(LIBM_SRC_DIR)/$(dir))) +$(foreach dir,$(SUBDIRS),$(eval vpath %.S $(LIBM_SRC_DIR)/$(dir))) + +$(foreach dir,$(SUBDIRS),$(eval INC_DIR += $(LIBM_SRC_DIR)/$(dir))) diff --git a/repos/libports/lib/mk/libm.mk b/repos/libports/lib/mk/libm.mk deleted file mode 100644 index e7ed4757c..000000000 --- a/repos/libports/lib/mk/libm.mk +++ /dev/null @@ -1,89 +0,0 @@ -LIBC_PORT_DIR := $(call select_from_ports,libc) -LIBC_DIR := $(LIBC_PORT_DIR)/src/lib/libc -LIBM_DIR := $(LIBC_DIR)/lib/msun - -LIBS = libc - -# -# finding 'math_private.h' -# -INC_DIR += $(LIBM_DIR)/src - -# -# finding 'invtrig.h', included by 'e_acosl.c' -# -INC_DIR += $(LIBM_DIR)/ld80 - -# -# finding 'fpmath.h', included by 'invtrig.h' -# -INC_DIR += $(LIBC_DIR)/lib/libc/include - -FILTER_OUT += s_exp2l.c - -# -# Files that are included by other sources (e.g., 's_sin.c'). Hence, we need -# to remove them from the build. Otherwise, we would end up with doubly -# defined symbols (and compiler warnings since those files are apparently -# not meant to be compiled individually). -# -FILTER_OUT += e_rem_pio2.c e_rem_pio2f.c - -# -# Disable warnings for selected files, i.e., to suppress -# 'is static but used in inline function which is not static' -# messages -# -CC_OPT_s_tanf = -w -CC_OPT_s_tan = -w -CC_OPT_s_sin = -w -CC_OPT_s_cos = -w -CC_OPT_s_cosf = -w -CC_OPT_s_sinf = -w -CC_OPT_k_cosf = -w -CC_OPT_k_sinf = -w -CC_OPT_k_tanf = -w - -# -# Work-around to get over doubly defined symbols produced by several sources -# that include 'e_rem_pio2.c' and 'e_rem_pio2f.c'. To avoid symbol clashes, -# we rename each occurrence by adding the basename of the compilation unit -# as suffix. -# -CC_OPT_s_sin += -D__ieee754_rem_pio2=__ieee754_rem_pio2_s_sin -CC_OPT_s_cos += -D__ieee754_rem_pio2=__ieee754_rem_pio2_s_cos -CC_OPT_s_sinf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_sinf -CC_OPT_s_sinf += -D__kernel_cosdf=__kernel_cosdf_sinf -CC_OPT_s_cosf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_cosf -CC_OPT_s_cosf += -D__kernel_sindf=__kernel_sindf_cosf -CC_OPT_s_tanf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_tanf - -# -# Use default warning level rather than -Wall because we do not want to touch -# the imported source code to improve build aesthetics. -# -CC_WARN = - -SRC_C = $(wildcard $(LIBM_DIR)/src/*.c) \ - $(wildcard $(LIBM_DIR)/ld80/*.c) \ - $(wildcard $(LIBM_DIR)/bsdsrc/*.c) -SRC_C := $(filter-out $(FILTER_OUT),$(notdir $(SRC_C))) - -# remove on update to version 9 -SRC_C += log2.c - -# -# 'e_rem_pio2.c' uses '__inline' -# -CC_OPT += -D__inline=inline - -vpath %.c $(LIBM_DIR)/src -vpath %.c $(LIBM_DIR)/ld80 -vpath %.c $(LIBM_DIR)/bsdsrc - -# remove on update to version 9 -vpath log2.c $(REP_DIR)/src/lib/libc - -SHARED_LIB = yes - -CC_CXX_WARN_STRICT = diff --git a/repos/libports/lib/mk/spec/arm/libm.mk b/repos/libports/lib/mk/spec/arm/libm.mk index 0bb46caf0..3fcfdda84 100644 --- a/repos/libports/lib/mk/spec/arm/libm.mk +++ b/repos/libports/lib/mk/spec/arm/libm.mk @@ -1,25 +1,2 @@ -# -# Cannot be compiled for ARM because this file relies on the 'xbits' -# member of union 'IEEEl2bits', which is not present in the ARM version. -# -FILTER_OUT = e_acosl.c e_asinl.c e_atan2l.c e_hypotl.c \ - s_atanl.c - -# -# Cannot be compiled for ARM because "Unsupported long double format" -# -FILTER_OUT += s_cosl.c s_frexpl.c s_nextafterl.c s_nexttoward.c \ - s_rintl.c s_scalbnl.c s_sinl.c s_tanl.c - -# -# Cannot be compiled for ARM because 'split' is undeclared -# -FILTER_OUT += s_fmal.c - -include $(REP_DIR)/lib/mk/libm.mk - -SRC_C += msun/arm/fenv.c - -vpath msun/arm/fenv.c $(LIBC_DIR)/lib - -CC_CXX_WARN_STRICT = +ARCH = arm +include $(REP_DIR)/lib/mk/libm.inc diff --git a/repos/libports/lib/mk/spec/arm_64/libm.mk b/repos/libports/lib/mk/spec/arm_64/libm.mk new file mode 100644 index 000000000..7e71e1835 --- /dev/null +++ b/repos/libports/lib/mk/spec/arm_64/libm.mk @@ -0,0 +1,2 @@ +ARCH = aarch64 +include $(REP_DIR)/lib/mk/libm.inc diff --git a/repos/libports/lib/mk/spec/x86_32/libm.mk b/repos/libports/lib/mk/spec/x86_32/libm.mk index 194f12869..616ebe620 100644 --- a/repos/libports/lib/mk/spec/x86_32/libm.mk +++ b/repos/libports/lib/mk/spec/x86_32/libm.mk @@ -1,7 +1,2 @@ -include $(REP_DIR)/lib/mk/libm.mk - -SRC_C += msun/i387/fenv.c - -vpath msun/i387/fenv.c $(LIBC_DIR)/lib - -CC_CXX_WARN_STRICT = +ARCH = i387 +include $(REP_DIR)/lib/mk/libm.inc diff --git a/repos/libports/lib/mk/spec/x86_64/libm.mk b/repos/libports/lib/mk/spec/x86_64/libm.mk index 4dd363771..a8734f8ad 100644 --- a/repos/libports/lib/mk/spec/x86_64/libm.mk +++ b/repos/libports/lib/mk/spec/x86_64/libm.mk @@ -1,7 +1,2 @@ -include $(REP_DIR)/lib/mk/libm.mk - -SRC_C += msun/amd64/fenv.c - -vpath msun/amd64/fenv.c $(LIBC_DIR)/lib - -CC_CXX_WARN_STRICT = +ARCH = amd64 +include $(REP_DIR)/lib/mk/libm.inc diff --git a/repos/libports/lib/symbols/libm b/repos/libports/lib/symbols/libm index 44b45f891..0943ecb21 100644 --- a/repos/libports/lib/symbols/libm +++ b/repos/libports/lib/symbols/libm @@ -1,4 +1,4 @@ -_ItL_aT R 208 +_ItL_aT R 384 _ItL_atanhi R 64 _ItL_atanlo R 64 _ItL_pS0 R 16 @@ -16,49 +16,53 @@ _ItL_qS4 R 16 _ItL_qS5 R 16 __exp__D T __fe_dfl_env R 32 -__fedisableexcept T -__feenableexcept T -__has_sse D 4 +__fpclassifyd T +__fpclassifyf T +__fpclassifyl T __ieee754_rem_pio2 T -__ieee754_rem_pio2_s_cos T -__ieee754_rem_pio2_s_sin T -__ieee754_rem_pio2f_s_cosf T -__ieee754_rem_pio2f_s_sinf T -__ieee754_rem_pio2f_s_tanf T +__ieee754_rem_pio2f T __isfinite T __isfinitef T __isfinitel T +__isinff T +__isinfl T +__isnanf T __isnanl T __isnormal T __isnormalf T __isnormall T __kernel_cos T __kernel_cosdf T -__kernel_cosdf_sinf T __kernel_cosl T __kernel_rem_pio2 T __kernel_sin T __kernel_sindf T -__kernel_sindf_cosf T __kernel_sinl T __kernel_tan T __kernel_tandf T __kernel_tanl T +__ldexp_cexp T +__ldexp_cexpf T +__ldexp_exp T +__ldexp_expf T __log__D T +__p1evll T +__polevll T +__scan_nan T __signbit T __signbitf T __signbitl T -__test_sse T -_scan_nan T acos T acosf T acosh T acoshf T +acoshl T acosl T asin T asinf T asinh T asinhf T +asinhl T asinl T atan T atan2 T @@ -67,21 +71,53 @@ atan2l T atanf T atanh T atanhf T +atanhl T atanl T cabs T cabsf T cabsl T +cacos T +cacosf T +cacosh T +cacoshf T +cacoshl T +cacosl T carg T cargf T cargl T +casin T +casinf T +casinh T +casinhf T +casinhl T +casinl T +catan T +catanf T +catanh T +catanhf T +catanhl T +catanl T cbrt T cbrtf T +cbrtl T +ccos T +ccosf T +ccosh T +ccoshf T +ccoshl T +ccosl T ceil T ceilf T ceill T +cexp T +cexpf T +cexpl T cimag T cimagf T cimagl T +clog T +clogf T +clogl T conj T conjf T conjl T @@ -92,43 +128,60 @@ cos T cosf T cosh T coshf T +coshl T cosl T +cpow T +cpowf T +cpowl T cproj T cprojf T cprojl T creal T crealf T creall T +csin T +csinf T +csinh T +csinhf T +csinhl T +csinl T csqrt T csqrtf T csqrtl T -drem T -dremf T +ctan T +ctanf T +ctanh T +ctanhf T +ctanhl T +ctanl T erf T erfc T erfcf T +erfcl T erff T +erfl T exp T exp2 T exp2f T +exp2l T expf T +expl T expm1 T expm1f T +expm1l T fabs T fabsf T fabsl T fdim T fdimf T fdiml T -fedisableexcept W -feenableexcept W +fedisableexcept T +feenableexcept T fegetenv T feholdexcept T feraiseexcept T fesetexceptflag T feupdateenv T -finite T -finitef T floor T floorf T floorl T @@ -147,29 +200,32 @@ fmodl T frexp T frexpf T frexpl T -gamma T -gamma_r T -gammaf T -gammaf_r T hypot T hypotf T hypotl T ilogb T ilogbf T ilogbl T -isnanf T +isinf T +isinff W +isnan T +isnanf W +isopenlibm T j0 T j0f T j1 T j1f T jn T jnf T +ldexp T ldexpf T ldexpl T lgamma T lgamma_r T lgammaf T lgammaf_r T +lgammal T +lgammal_r T llrint T llrintf T llrintl T @@ -179,14 +235,18 @@ llroundl T log T log10 T log10f T +log10l T log1p T log1pf T +log1pl T log2 T log2f T +log2l T logb T logbf T logbl T logf T +logl T lrint T lrintf T lrintl T @@ -210,6 +270,7 @@ nexttowardf T nexttowardl T pow T powf T +powl T remainder T remainderf T remainderl T @@ -222,8 +283,6 @@ rintl T round T roundf T roundl T -scalb T -scalbf T scalbln T scalblnf T scalblnl T @@ -231,12 +290,14 @@ scalbn T scalbnf T scalbnl T signgam B 4 -significand T -significandf T sin T +sincos T +sincosf T +sincosl T sinf T sinh T sinhf T +sinhl T sinl T sqrt T sqrtf T @@ -245,9 +306,11 @@ tan T tanf T tanh T tanhf T +tanhl T tanl T tgamma T tgammaf T +tgammal T trunc T truncf T truncl T diff --git a/repos/libports/ports/openlibm.hash b/repos/libports/ports/openlibm.hash new file mode 100644 index 000000000..ceda38df4 --- /dev/null +++ b/repos/libports/ports/openlibm.hash @@ -0,0 +1 @@ +c1868f791e2a4dd9c2c31af84a425924179f1580 diff --git a/repos/libports/ports/openlibm.port b/repos/libports/ports/openlibm.port new file mode 100644 index 000000000..0600f6880 --- /dev/null +++ b/repos/libports/ports/openlibm.port @@ -0,0 +1,14 @@ +LICENSE = MIT+ISC+BSD +DOWNLOADS = openlibm.archive +VERSION = 0.6.0 + +OWNER := JuliaMath +REPO := openlibm +REV := a96f0740e32c3d8aaa0a34c3988201018dfa90ce + +URL(openlibm) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz +SHA(openlibm) := a9c7d4450c3e9a8b92ec1e20c7a9fd2682e900743dff37f163c9a9ac68b4f471 +DIR(openlibm) := src/lib/openlibm + +DIRS := include/openlibm +DIR_CONTENT(include/openlibm) = src/lib/openlibm/include/*