Skip to content

Commit c4de358

Browse files
committed
[libc] Fix wrapper headers for at_quick_exit on GLIBC
Summary: GLIBC likes to define this with the C++ linkage in the header, which conflict. For now just hack around it by pretending it's `atexit` since it has the same signature.
1 parent 15e86c2 commit c4de358

File tree

1 file changed

+8
-0
lines changed
  • clang/lib/Headers/llvm_libc_wrappers

1 file changed

+8
-0
lines changed

clang/lib/Headers/llvm_libc_wrappers/stdlib.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ _Static_assert(__builtin_offsetof(div_t, quot) == 0, "ABI mismatch!");
3434
_Static_assert(__builtin_offsetof(ldiv_t, quot) == 0, "ABI mismatch!");
3535
_Static_assert(__builtin_offsetof(lldiv_t, quot) == 0, "ABI mismatch!");
3636

37+
#if defined(__GLIBC__) && __cplusplus >= 201703L
38+
#define at_quick_exit atexit
39+
#endif
40+
3741
#include <llvm-libc-decls/stdlib.h>
3842

43+
#if defined(__GLIBC__) && __cplusplus >= 201703L
44+
#undef at_quick_exit
45+
#endif
46+
3947
#pragma omp end declare target
4048

4149
#undef __LIBC_ATTRS

0 commit comments

Comments
 (0)