[libcxx-commits] [libcxx] [libc++] Avoid redeclaring lgamma_r (PR #153631)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 4 08:23:13 PDT 2025


ldionne wrote:

@philnik777 I was going to go down the route of adding `__lgamma_r` to `libc++.dylib` and dancing around back-deployment, but then I found out that GCC provides `__builtin_lgamma_r` while Clang doesn't: https://godbolt.org/z/4jWrWzf6n

We [already provide](https://github.com/llvm/llvm-project/blob/e90ab31024a7ad906db45e229fdb0f2fda7b2107/libcxx/include/__math/gamma.h#L26) definitions for `std::lgamma` in our headers and those forward to the compiler builtins. It would feel a bit silly to add an indirection through the dylib to implement `__lgamma_r` when Clang just seems to be missing a builtin (which would increase GCC compatibility).

Do you agree that requesting a Clang builtin seems like the better approach? Then we would simply use the builtin from here unconditionally.

https://github.com/llvm/llvm-project/pull/153631


More information about the libcxx-commits mailing list