summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch
diff options
context:
space:
mode:
authormaxim-yurchuk <[email protected]>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <[email protected]>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch')
-rw-r--r--contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch b/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch
new file mode 100644
index 00000000000..bd826ae06ef
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/patches/01-commit-e0e82fc-initial.patch
@@ -0,0 +1,98 @@
+diff --git a/include/__config b/include/__config
+index 52bf12f..e431997 100644
+--- a/include/__config
++++ b/include/__config
+@@ -131,7 +131,12 @@
+ // Previously libc++ used "unsigned int" exclusively.
+ # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
+ // Unstable attempt to provide a more optimized std::function
++#ifdef __EMSCRIPTEN__
++// XXX EMSCRIPTEN https://github.com/emscripten-core/emscripten/issues/11022
++//# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
++#else
+ # define _LIBCPP_ABI_OPTIMIZED_FUNCTION
++#endif
+ // All the regex constants must be distinct and nonzero.
+ # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+ // Re-worked external template instantiations for std::string with a focus on
+diff --git a/include/typeinfo b/include/typeinfo
+index 59bc291..eb3dc59 100644
+--- a/include/typeinfo
++++ b/include/typeinfo
+@@ -104,6 +104,11 @@ public:
+
+ size_t hash_code() const _NOEXCEPT;
+
++#ifdef __EMSCRIPTEN__
++ // XXX Emscripten: adding `always_inline` fixes
++ // https://github.com/emscripten-core/emscripten/issues/13330
++ __attribute__((always_inline))
++#endif
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
+ bool operator==(const type_info& __arg) const _NOEXCEPT {
+ // When evaluated in a constant expression, both type infos simply can't come
+diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp
+index 63a119a..61f2cc5 100644
+--- a/src/filesystem/operations.cpp
++++ b/src/filesystem/operations.cpp
+@@ -37,7 +37,7 @@
+ #include <time.h>
+ #include <fcntl.h> /* values for fchmodat */
+
+-#if __has_include(<sys/sendfile.h>)
++#if __has_include(<sys/sendfile.h>) && !defined(__EMSCRIPTEN__)
+ # include <sys/sendfile.h>
+ # define _LIBCPP_FILESYSTEM_USE_SENDFILE
+ #elif defined(__APPLE__) || __has_include(<copyfile.h>)
+diff --git a/src/new.cpp b/src/new.cpp
+index c435c5f..6d5b221 100644
+--- a/src/new.cpp
++++ b/src/new.cpp
+@@ -37,8 +37,17 @@ operator new(std::size_t size) _THROW_BAD_ALLOC
+ else
+ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw std::bad_alloc();
++#else
++#ifdef __EMSCRIPTEN__
++ // Abort here so that when exceptions are disabled, we do not just
++ // return 0 when malloc returns 0.
++ // We could also do this with set_new_handler, but that adds a
++ // global constructor and a table entry, overhead that we can avoid
++ // by doing it this way.
++ abort();
+ #else
+ break;
++#endif
+ #endif
+ }
+ return p;
+diff --git a/src/support/runtime/exception_fallback.ipp b/src/support/runtime/exception_fallback.ipp
+index 3b2716d..c14c375 100644
+--- a/src/support/runtime/exception_fallback.ipp
++++ b/src/support/runtime/exception_fallback.ipp
+@@ -47,6 +47,7 @@ get_terminate() noexcept
+ return __libcpp_atomic_load(&__terminate_handler);
+ }
+
++#ifndef __EMSCRIPTEN__ // We provide this in JS
+ _LIBCPP_NORETURN
+ void
+ terminate() noexcept
+@@ -69,7 +70,9 @@ terminate() noexcept
+ }
+ #endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
++#endif // !__EMSCRIPTEN__
+
++#if !defined(__EMSCRIPTEN__)
+ bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
+
+ int uncaught_exceptions() noexcept
+@@ -78,6 +81,7 @@ int uncaught_exceptions() noexcept
+ fprintf(stderr, "uncaught_exceptions not yet implemented\n");
+ ::abort();
+ }
++#endif // !__EMSCRIPTEN__
+
+
+ exception::~exception() noexcept