From f22d7db106c79fc95c04cbefa839de1e07716a99 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Mon, 26 May 2014 10:23:33 +0100 Subject: [PATCH] Fixed build on ARM Removed all long double support, since ARM doesn't have long doubles. --- Makefile | 5 ++++- arm/fenv.h | 2 +- include/fenv.h | 4 ++++ src/Make.files | 9 ++++++--- src/openlibm.h | 4 ++++ src/s_fpclassify.c | 3 ++- src/s_isfinite.c | 2 ++ src/s_isinf.c | 2 ++ src/s_isnan.c | 2 ++ src/s_isnormal.c | 2 ++ src/s_nexttowardf.c | 2 ++ src/s_signbit.c | 2 ++ 12 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 789f7d9..00cc065 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ OPENLIBM_HOME=$(abspath .) include ./Make.inc -SUBDIRS = src ld80 $(ARCH) bsdsrc +SUBDIRS = src $(ARCH) bsdsrc +ifneq ($(ARCH), arm) +SUBDIRS += ld80 +endif define INC_template TEST=test diff --git a/arm/fenv.h b/arm/fenv.h index 3421b8f..22bd396 100644 --- a/arm/fenv.h +++ b/arm/fenv.h @@ -29,7 +29,7 @@ #ifndef _FENV_H_ #define _FENV_H_ -#include +#include #ifndef __fenv_static #define __fenv_static static diff --git a/include/fenv.h b/include/fenv.h index f60bc0d..cfe40b9 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -1,5 +1,9 @@ +#ifdef __arm__ +#include "../arm/fenv.h" +#else #ifdef __LP64 #include "../amd64/fenv.h" #else #include "../i387/fenv.h" #endif +#endif diff --git a/src/Make.files b/src/Make.files index 04abe4d..668af4c 100644 --- a/src/Make.files +++ b/src/Make.files @@ -17,10 +17,10 @@ $(CUR_SRCS) = common.c \ s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabs.c s_fabsf.c s_fdim.c \ s_finite.c s_finitef.c \ s_floor.c s_floorf.c s_fma.c s_fmaf.c \ - s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \ - s_fminf.c s_fminl.c s_fpclassify.c \ + s_fmax.c s_fmaxf.c s_fmin.c \ + s_fminf.c s_fpclassify.c \ s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \ - s_ilogbl.c s_isinf.c s_isfinite.c s_isnormal.c s_isnan.c \ + s_isinf.c s_isfinite.c s_isnormal.c s_isnan.c \ s_llrint.c s_llrintf.c s_llround.c s_llroundf.c s_llroundl.c \ s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \ s_lround.c s_lroundf.c s_lroundl.c s_modf.c s_modff.c \ @@ -37,11 +37,13 @@ ifneq ($(OS), WINNT) $(CUR_SRCS) += s_nan.c endif +ifneq ($(ARCH), arm) # C99 long double functions $(CUR_SRCS) += s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c # If long double != double use these; otherwise, we alias the double versions. $(CUR_SRCS) += e_acosl.c e_asinl.c e_atan2l.c e_fmodl.c \ + s_fmaxl.c s_fminl.c s_ilogbl.c \ e_hypotl.c e_remainderl.c e_sqrtl.c \ s_atanl.c s_ceill.c s_cosl.c s_cprojl.c \ s_csqrtl.c s_floorl.c s_fmal.c \ @@ -50,6 +52,7 @@ $(CUR_SRCS) += e_acosl.c e_asinl.c e_atan2l.c e_fmodl.c \ s_sinl.c s_sincosl.c s_tanl.c s_truncl.c w_cabsl.c \ s_nextafterl.c s_rintl.c s_scalbnl.c # s_cbrtl.c +endif # C99 complex functions $(CUR_SRCS) += s_ccosh.c s_ccoshf.c s_cexp.c s_cexpf.c \ diff --git a/src/openlibm.h b/src/openlibm.h index ef118a2..153f9ae 100644 --- a/src/openlibm.h +++ b/src/openlibm.h @@ -23,6 +23,10 @@ #define __WIN32__ #endif +#ifndef __arm__ +#define LONG_DOUBLE +#endif + #define __pure2 /* diff --git a/src/s_fpclassify.c b/src/s_fpclassify.c index 79efb62..e850ecd 100644 --- a/src/s_fpclassify.c +++ b/src/s_fpclassify.c @@ -72,6 +72,7 @@ __fpclassifyf(float f) } } +#ifdef LONG_DOUBLE DLLEXPORT int __fpclassifyl(long double e) { @@ -93,5 +94,5 @@ __fpclassifyl(long double e) return FP_SUBNORMAL; } } - +#endif diff --git a/src/s_isfinite.c b/src/s_isfinite.c index 0ae3549..cd697e7 100644 --- a/src/s_isfinite.c +++ b/src/s_isfinite.c @@ -48,6 +48,7 @@ __isfinitef(float f) return (u.bits.exp != 255); } +#ifdef LONG_DOUBLE DLLEXPORT int __isfinitel(long double e) { @@ -56,3 +57,4 @@ __isfinitel(long double e) u.e = e; return (u.bits.exp != 32767); } +#endif diff --git a/src/s_isinf.c b/src/s_isinf.c index 08c3cce..041c4ec 100644 --- a/src/s_isinf.c +++ b/src/s_isinf.c @@ -50,6 +50,7 @@ __isinff(float f) return (u.bits.exp == 255 && u.bits.man == 0); } +#ifdef LONG_DOUBLE DLLEXPORT int __isinfl(long double e) { @@ -59,5 +60,6 @@ __isinfl(long double e) mask_nbit_l(u); return (u.bits.exp == 32767 && u.bits.manl == 0 && u.bits.manh == 0); } +#endif __weak_reference(__isinff, isinff); diff --git a/src/s_isnan.c b/src/s_isnan.c index 5d903e9..21f4f64 100644 --- a/src/s_isnan.c +++ b/src/s_isnan.c @@ -51,6 +51,7 @@ __isnanf(float f) return (u.bits.exp == 255 && u.bits.man != 0); } +#ifdef LONG_DOUBLE DLLEXPORT int __isnanl(long double e) { @@ -60,5 +61,6 @@ __isnanl(long double e) mask_nbit_l(u); return (u.bits.exp == 32767 && (u.bits.manl != 0 || u.bits.manh != 0)); } +#endif __weak_reference(__isnanf, isnanf); diff --git a/src/s_isnormal.c b/src/s_isnormal.c index bcdb86b..6a702c5 100644 --- a/src/s_isnormal.c +++ b/src/s_isnormal.c @@ -48,6 +48,7 @@ __isnormalf(float f) return (u.bits.exp != 0 && u.bits.exp != 255); } +#ifdef LONG_DOUBLE DLLEXPORT int __isnormall(long double e) { @@ -56,3 +57,4 @@ __isnormall(long double e) u.e = e; return (u.bits.exp != 0 && u.bits.exp != 32767); } +#endif diff --git a/src/s_nexttowardf.c b/src/s_nexttowardf.c index 4c1902f..d708062 100644 --- a/src/s_nexttowardf.c +++ b/src/s_nexttowardf.c @@ -20,6 +20,7 @@ #define LDBL_INFNAN_EXP (LDBL_MAX_EXP * 2 - 1) +#ifdef LONG_DOUBLE DLLEXPORT float nexttowardf(float x, long double y) { @@ -57,3 +58,4 @@ nexttowardf(float x, long double y) SET_FLOAT_WORD(x,hx); return x; } +#endif diff --git a/src/s_signbit.c b/src/s_signbit.c index bf3463b..00529b5 100644 --- a/src/s_signbit.c +++ b/src/s_signbit.c @@ -48,6 +48,7 @@ __signbitf(float f) return (u.bits.sign); } +#ifdef LONG_DOUBLE DLLEXPORT int __signbitl(long double e) { @@ -56,3 +57,4 @@ __signbitl(long double e) u.e = e; return (u.bits.sign); } +#endif