aboutsummaryrefslogtreecommitdiff
path: root/math/pow.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2018-06-06 12:26:56 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2018-06-12 16:08:40 +0100
commitb7d568d7eee5914a13a728017d1b0b8442bb5feb (patch)
tree95b2d66c4a2eeae97a886f6b946b108660b312ac /math/pow.c
parent875334a2c756b7782c4630dc015763247750438d (diff)
downloadarm-optimized-routines-b7d568d7eee5914a13a728017d1b0b8442bb5feb.tar.gz
Add _finite symbol aliases for better glibc compatibility
The glibc math.h header can redirect math symbols (e.g. with the -ffinite-math-only cflag) to _finite symbols which have the same semantics as the original ones except they may omit some error checks. With these aliases libmathlib can be a drop in replacement for glibc libm at link time. It's not a full replacement, but it can interpose glibc libm calls using LD_PRELOAD in case of an already dynamic linked binary or using -lmathlib before -lm at link time. This hopefully will make it easy to try libmathlib with a glibc based toolchain. Unfortunately with static linking the glibc _finite symbol definitions may conflict with the libmathlib definitions if other glibc internal symbols are used from the same object file where the _finite symbol is defined. To work this around add glibc internal symbols as hidden aliases so the conflicting glibc object files don't get linked. This is a bit fragile since glibc can change its internal symbols and how they are used, but it only affects static linking, which always has this problem when symbols are interposed.
Diffstat (limited to 'math/pow.c')
-rw-r--r--math/pow.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/math/pow.c b/math/pow.c
index 3d92784..1164ce1 100644
--- a/math/pow.c
+++ b/math/pow.c
@@ -369,3 +369,7 @@ pow (double x, double y)
#endif
return exp_inline (ehi, elo, sign_bias);
}
+#if USE_GLIBC_ABI
+strong_alias (pow, __pow_finite)
+hidden_alias (pow, __ieee754_pow)
+#endif