Index: include/clang/Basic/BuiltinsWebAssembly.def =================================================================== --- include/clang/Basic/BuiltinsWebAssembly.def +++ include/clang/Basic/BuiltinsWebAssembly.def @@ -16,9 +16,21 @@ // The format of this database matches clang/Basic/Builtins.def. +#if defined(BUILTIN) && !defined(LIBBUILTIN) +# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS) +#endif + // Note that current_memory is not "c" (readnone) because it must be sequenced // with respect to grow_memory calls. BUILTIN(__builtin_wasm_current_memory, "z", "n") BUILTIN(__builtin_wasm_grow_memory, "zz", "n") +// Redeclaring lgamma from Builtins.def as non-const to allow for POSIX +// compatibility. Specifically lgamma writes to a user-visible global, signgam, +// that is available in POSIX-compliant libcs. +LIBBUILTIN(lgamma, "dd", "fn", "math.h") +LIBBUILTIN(lgammaf, "ff", "fn", "math.h") +LIBBUILTIN(lgammal, "LdLd", "fn", "math.h") + #undef BUILTIN +#undef LIBBUILTIN