Skip to content

Commit

Permalink
Update llvm libraries to 15.0.6 (#18328)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Dec 7, 2022
1 parent 515e349 commit 1bc4900
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6703,7 +6703,7 @@ INTERCEPTOR(int, sem_init, __sanitizer_sem_t *s, int pshared, unsigned value) {
COMMON_INTERCEPTOR_ENTER(ctx, sem_init, s, pshared, value);
// Workaround a bug in glibc's "old" semaphore implementation by
// zero-initializing the sem_t contents. This has to be done here because
// interceptors bind to the lowest symbols version by default, hitting the
// interceptors bind to the lowest version before glibc 2.36, hitting the
// buggy code path while the non-sanitized build of the same code works fine.
REAL(memset)(s, 0, sizeof(*s));
int res = REAL(sem_init)(s, pshared, value);
Expand Down
33 changes: 20 additions & 13 deletions system/lib/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@
# pragma GCC system_header
#endif

#if defined(__apple_build_version__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
#elif defined(__clang__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
#elif defined(__GNUC__)
# define _LIBCPP_COMPILER_GCC
#elif defined(_MSC_VER)
# define _LIBCPP_COMPILER_MSVC
#endif

#ifdef __cplusplus

# define _LIBCPP_VERSION 15000
# define _LIBCPP_VERSION 15006

# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
Expand Down Expand Up @@ -199,18 +211,6 @@
# define __has_include(...) 0
# endif

# if defined(__apple_build_version__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
# elif defined(__clang__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
# elif defined(__GNUC__)
# define _LIBCPP_COMPILER_GCC
# elif defined(_MSC_VER)
# define _LIBCPP_COMPILER_MSVC
# endif

# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
# endif
Expand Down Expand Up @@ -1102,6 +1102,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
# endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES

// Leave the deprecation notices in by default, but don't remove unary_function and
// binary_function entirely just yet. That way, folks will have one release to act
// on the deprecation warnings.
# ifndef _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
# endif

# if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION
Expand Down
14 changes: 12 additions & 2 deletions system/lib/libcxx/include/__functional/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
#endif // _LIBCPP_NO_RTTI
};

#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)

extern "C" void *_Block_copy(const void *);
extern "C" void _Block_release(const void *);
Expand All @@ -898,14 +898,22 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
public:
_LIBCPP_INLINE_VISIBILITY
explicit __func(__block_type const& __f)
#ifdef _LIBCPP_HAS_OBJC_ARC
: __f_(__f)
#else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
#endif
{ }

// [TODO] add && to save on a retain

_LIBCPP_INLINE_VISIBILITY
explicit __func(__block_type __f, const _Alloc& /* unused */)
#ifdef _LIBCPP_HAS_OBJC_ARC
: __f_(__f)
#else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
#endif
{ }

virtual __base<_Rp(_ArgTypes...)>* __clone() const {
Expand All @@ -921,8 +929,10 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
}

virtual void destroy() _NOEXCEPT {
#ifndef _LIBCPP_HAS_OBJC_ARC
if (__f_)
_Block_release(__f_);
#endif
__f_ = 0;
}

Expand Down Expand Up @@ -950,7 +960,7 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
#endif // _LIBCPP_NO_RTTI
};

#endif // _LIBCPP_HAS_EXTENSION_BLOCKS && !_LIBCPP_HAS_OBJC_ARC
#endif // _LIBCPP_HAS_EXTENSION_BLOCKS

} // namespace __function

Expand Down
46 changes: 9 additions & 37 deletions system/lib/libcxx/include/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,12 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
#endif

template <class _Tp>
struct __libcpp_is_always_lock_free {
// __atomic_always_lock_free is available in all Standard modes
static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0);
};

#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS

template<typename _Tp>
Expand Down Expand Up @@ -1404,42 +1410,8 @@ _Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}

#ifdef __cpp_lib_atomic_is_always_lock_free

template<typename _Tp> struct __cxx_is_always_lock_free {
enum { __value = __atomic_always_lock_free(sizeof(_Tp), 0) }; };

#else

template<typename _Tp> struct __cxx_is_always_lock_free { enum { __value = false }; };
// Implementations must match the C ATOMIC_*_LOCK_FREE macro values.
template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC_BOOL_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; };
#endif
template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
#endif
template<> struct __cxx_is_always_lock_free<short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
template<typename _Tp> struct __cxx_is_always_lock_free<_Tp*> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<std::nullptr_t> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };

#endif //__cpp_lib_atomic_is_always_lock_free

template <typename _Tp,
typename _Base = typename conditional<__cxx_is_always_lock_free<_Tp>::__value,
typename _Base = typename conditional<__libcpp_is_always_lock_free<_Tp>::__value,
__cxx_atomic_base_impl<_Tp>,
__cxx_atomic_lock_impl<_Tp> >::type>
#else
Expand Down Expand Up @@ -1561,7 +1533,7 @@ struct __atomic_base // false
mutable __cxx_atomic_impl<_Tp> __a_;

#if defined(__cpp_lib_atomic_is_always_lock_free)
static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);
static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
#endif

_LIBCPP_INLINE_VISIBILITY
Expand Down Expand Up @@ -2664,7 +2636,7 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
// atomic_*_lock_free : prefer the contention type most highly, then the largest lock-free type

#ifdef __cpp_lib_atomic_is_always_lock_free
# define _LIBCPP_CONTENTION_LOCK_FREE __atomic_always_lock_free(sizeof(__cxx_contention_t), 0)
# define _LIBCPP_CONTENTION_LOCK_FREE ::std::__libcpp_is_always_lock_free<__cxx_contention_t>::__value
#else
# define _LIBCPP_CONTENTION_LOCK_FREE false
#endif
Expand Down
4 changes: 2 additions & 2 deletions system/lib/libcxx/include/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ using std::atomic_signal_fence // see below
# pragma GCC system_header
#endif

#if _LIBCPP_STD_VER > 20
#if defined(__cplusplus) && _LIBCPP_STD_VER > 20

#include <atomic>
#include <version>
Expand Down Expand Up @@ -230,6 +230,6 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
# include_next <stdatomic.h>
# endif

#endif // _LIBCPP_STD_VER > 20
#endif // defined(__cplusplus) && _LIBCPP_STD_VER > 20

#endif // _LIBCPP_STDATOMIC_H
2 changes: 1 addition & 1 deletion system/lib/libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ __cpp_lib_void_t 201411L <type_traits>
# undef __cpp_lib_execution
// # define __cpp_lib_execution 201902L
# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
# define __cpp_lib_format 202106L
// # define __cpp_lib_format 202106L
# endif
# define __cpp_lib_generic_unordered_lookup 201811L
# define __cpp_lib_int_pow2 202002L
Expand Down
9 changes: 3 additions & 6 deletions system/lib/libcxx/readme.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
llvm's libcxx
-------------

These files are from the llvm-project based on release 14.0.0.
These files are from the llvm-project based on release 15.0.0.

We maintain a local fork of llvm-project that contains any emscripten
specific patches:

https://github.com/emscripten-core/llvm-project

The current patch is based on:

tag: llvmorg-14.0.0
git: 329fda39c507e8740978d10458451dcdb21563be
The current patch is based on the emscripten-libs-15.0.0 tag.

Update Instructions
-------------------
Expand All @@ -23,4 +20,4 @@ Modifications

For a list of changes from upstream see the libcxx files that are part of:

https://github.com/llvm/llvm-project/compare/llvmorg-14.0.0...emscripten-core:emscripten-libs-14.0.0
https://github.com/llvm/llvm-project/compare/llvmorg-15.0.0...emscripten-core:emscripten-libs-15.0.0
4 changes: 0 additions & 4 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3295,10 +3295,6 @@ def test_cocos2d_hello(self):
self.btest('cocos2d_hello.cpp', reference='cocos2d_hello.png', reference_slack=1,
args=['-sUSE_COCOS2D=3', '-sERROR_ON_UNDEFINED_SYMBOLS=0',
'-Wno-js-compiler',
# cocos2d uses std::binary_function which was removing in C++17.
# We could pass `-std=c++14` here but that doesn't currently work for btest
# since we compile a C file (report_result.c) in the same command.
'-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION',
'--preload-file', preload_file, '--use-preload-plugins',
'-Wno-inconsistent-missing-override',
'-Wno-deprecated-declarations'])
Expand Down

0 comments on commit 1bc4900

Please sign in to comment.