[libcxx-dev] Adding a _LIBCXX_HAS_NO_LONG_DOUBLE

Dionna Glaze via libcxx-dev libcxx-dev at lists.llvm.org
Tue Jul 2 14:33:25 PDT 2019

Thanks, I've gone ahead and made https://reviews.llvm.org/D64105 since
sizeof(long double) != sizeof(double) for our platform and I don't have
software implementations of long double math operations to contribute.

On Tue, Jul 2, 2019 at 1:26 PM JF Bastien <jfbastien at apple.com> wrote:

> We added some support newlib with NaCl / PNaCl. IIRC we didn’t do anything
> for long double because it mapped to double on our target, which might be
> what you want to do in your case.
> However, if you do want to support long double in some form, check out
> e.g. http://reviews.llvm.org/D7888. include/__config is probably where
> you want to look, and see how other platforms handle types like that.
> On Jul 2, 2019, at 11:25 AM, Dionna Glaze via libcxx-dev <
> libcxx-dev at lists.llvm.org> wrote:
> Heya folks, new contributor here. I work at Google on the Asylo project
> for enclave development. I'm in the process of switching our toolchain over
> to clang from GCC, and I've found that I have some minor problems doing so
> with newlib as our libc implementation.
> Mainly, long double math operations are not supported by newlib. In
> libstdc++, if long double functions weren't defined in libc (#ifndef
> HAVE_HYPOTL, etc, ...), it'd define them itself. That's not the case in
> libc++, so I was wondering what y'all thought would be the best course of
> action.
> Mainly, should libc++ act like libstdc++ and define its own long double
> implementations of math operations, or should it not add the functions to
> the std:: namespace if they're not available?
> If not adding them, then the following headers would guard given
> declarations within _LIBCPP_HAS_NO_LONG_DOUBLE/#endif:
> #include <cmath>:
> using ::nexttoward;
> using ::nexttowardf;
> using ::acosl;
> [...contiguously down to...]
> using ::truncl;
> inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long
> double y, long double z ) { return sqrt(x*x + y*y + z*z); }
> #include <cstdlib>:
> using ::strtold;
> #include <locale>:
> [...] long double __do_strtod<long double> [...]
> #include <math.h>:
> [...everything that mentions long double in its prototype...]
> I can produce a patch quickly if this is an acceptable change to folks.
> Regards,
> -Dionna Glaze, PhD (she/her)
> _______________________________________________
> libcxx-dev mailing list
> libcxx-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190702/0da52eb6/attachment.html>

More information about the libcxx-dev mailing list