This allows compiling libc++, even when the C library doesn't support floating point math.
- Group Reviewers
- rG650da4a690f9: [libc++][math.h] Use builtins for all the functions
Looks good but you're hitting the same problem I did with AIX.
I suspect that __builtin_ldexpl is the one that's causing the trouble but haven't been able to prove it. @xingxue did give me access to an AIX machine but unfortunately it's under such heavy load already that it's not really usable. The path I took was to not use long double builtins on AIX ¯\_(ツ)_/¯
LGTM but please ping me if you need major changes to make the CI pass.
The issue is that AIX implements math functions frexpl(), ldexpl(), and modfl() as 128-bit long double but for other math functions, AIX libm has 64-bit long double wrappers. Currently, the Clang compiler on AIX supports 64-bit long double only and therefore, frexpl(), ldexpl(), and modfl() would seg-fault. We are looking into a fix.
I know this is not the main purpose of this patch, but this doesn't help us if we want to support systems where e.g. tgamma(double) is not provided. Indeed, with this patch, we end up calling tgama(double) below, which is ambiguous between tgamma(float) and tgamma(long double), since there is no tgamma(double).