diff --git a/tur-chromium/chromium-stable/1001-chromium-disable-sandbox.patch b/tur-chromium/chromium-stable/1001-chromium-disable-sandbox.patch index c526b31..1eb3436 100644 --- a/tur-chromium/chromium-stable/1001-chromium-disable-sandbox.patch +++ b/tur-chromium/chromium-stable/1001-chromium-disable-sandbox.patch @@ -29,9 +29,9 @@ // TODO(crbug.com/40188745): Implement crash reporter integration for Fuchsia. --- a/chrome/browser/ui/startup/bad_flags_prompt.cc +++ b/chrome/browser/ui/startup/bad_flags_prompt.cc -@@ -60,10 +60,12 @@ - static const char* kBadFlags[] = { - network::switches::kIgnoreCertificateErrorsSPKIList, +@@ -67,10 +67,12 @@ + switches::kHostRules, + // These flags disable sandbox-related security. +#ifndef __TERMUX__ sandbox::policy::switches::kDisableGpuSandbox, @@ -44,9 +44,9 @@ #endif --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc -@@ -235,6 +235,10 @@ - #include "ui/gfx/switches.h" - #endif +@@ -226,6 +226,10 @@ + #include "ui/ozone/public/ozone_platform.h" + #endif // BUILDFLAG(IS_OZONE) +#ifdef __TERMUX__ +#include "sandbox/policy/switches.h" @@ -55,7 +55,7 @@ base::LazyInstance::DestructorAtExit g_chrome_content_gpu_client = LAZY_INSTANCE_INITIALIZER; base::LazyInstance::DestructorAtExit -@@ -1037,6 +1041,14 @@ +@@ -1061,6 +1065,14 @@ const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -72,7 +72,7 @@ // web security by setting the kWebKitWebSecurityEnabled pref directly. --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc -@@ -131,6 +131,10 @@ +@@ -140,6 +140,10 @@ #include "media/mojo/services/media_foundation_preferences.h" #endif // BUILDFLAG(IS_WIN) @@ -83,7 +83,7 @@ namespace content { namespace { -@@ -405,6 +409,9 @@ +@@ -448,6 +452,9 @@ // to shell_main.cc that it's a browser test. switches::kBrowserTest, #endif diff --git a/tur-chromium/chromium-stable/1010-chromium-no-priority-inheritance-locks.patch b/tur-chromium/chromium-stable/1010-chromium-no-priority-inheritance-locks.patch deleted file mode 100644 index 253465a..0000000 --- a/tur-chromium/chromium-stable/1010-chromium-no-priority-inheritance-locks.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/base/synchronization/lock_impl_posix.cc -+++ b/base/synchronization/lock_impl_posix.cc -@@ -59,7 +59,7 @@ - // Lock::PriorityInheritanceAvailable still must be checked as the code may - // compile but the underlying platform still may not correctly support priority - // inheritance locks. --#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) -+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || defined(__TERMUX__) - #define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 0 - #else - #define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 1 diff --git a/tur-chromium/chromium-stable/1021-chromium-partition-allocator-memfd.patch b/tur-chromium/chromium-stable/1010-chromium-partition-allocator-memfd.patch similarity index 100% rename from tur-chromium/chromium-stable/1021-chromium-partition-allocator-memfd.patch rename to tur-chromium/chromium-stable/1010-chromium-partition-allocator-memfd.patch diff --git a/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch b/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch index 1dd4364..fadfcc2 100644 --- a/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch +++ b/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch @@ -2,441 +2,612 @@ --- a/base/__termux_header_only_atomic_ref_polyfill.h +++ b/base/__termux_header_only_atomic_ref_polyfill.h -@@ -0,0 +1,436 @@ -+// Origin: https://github.com/avakar/atomic_ref -+// Origin Description: Header-only implementation of std::atomic_ref for C++14 -+// Origin LICENSE: MIT -+// MIT License -+ -+// Permission is hereby granted, free of charge, to any person obtaining a copy -+// of this software and associated documentation files (the "Software"), to deal -+// in the Software without restriction, including without limitation the rights -+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+// copies of the Software, and to permit persons to whom the Software is -+// furnished to do so, subject to the following conditions: -+ -+// The above copyright notice and this permission notice shall be included in all -+// copies or substantial portions of the Software. -+ -+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+// SOFTWARE. +@@ -0,0 +1,607 @@ ++// Origin: https://github.com/ORNL/cpp-proposals-pub ++// Origin Description: Collaborating on papers for the ISO C++ committee - public repo ++// Origin LICENSE: Public Domain + +#ifndef TERMUX_HEADER_ONLY_ATOMIC_REF_POLYFILL_H +#define TERMUX_HEADER_ONLY_ATOMIC_REF_POLYFILL_H + -+// INCLUDE: https://github.com/avakar/atomic_ref/blob/bf1b16afbf3c98754d33fd601c3e53b892cd7cab/src/atomic_ref.gcc.h ++// INCLUDE: https://github.com/ORNL/cpp-proposals-pub/blob/688e59475994cc71011d916f8d08e20513109728/P0019/atomic_ref.hpp ++//------------------------------------------------------------------------------ ++// std::experimental::atomic_ref ++// ++// reference implementation for compilers which support GNU atomic builtins ++// https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html ++// ++//------------------------------------------------------------------------------ ++ +#include +#include ++#include ++#include + -+namespace _avakar { -+namespace atomic_ref { ++#if defined( _MSC_VER ) //msvc ++ #error "Error: MSVC not currently supported" ++#endif + -+template -+struct is_always_lock_free -+ : std::integral_constant -+{ -+}; ++#ifndef ATOMIC_REF_FORCEINLINE ++ #define ATOMIC_REF_FORCEINLINE inline __attribute__((always_inline)) ++#endif + -+template -+struct is_always_wait_free -+ : std::false_type -+{ -+}; ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wsign-conversion" + -+template -+std::enable_if_t::value, T> load(T const & obj, std::memory_order order) noexcept -+{ -+ return (T)__atomic_load_n((std::underlying_type_t const *)&obj, (int)order); -+} ++namespace Foo { + -+template -+std::enable_if_t::value, T> load(T const & obj, std::memory_order order) noexcept -+{ -+ return __atomic_load_n(&obj, (int)order); ++template ++constexpr typename std::underlying_type::type to_underlying(E e) noexcept { ++ return static_cast::type>(e); +} + -+template -+void store(T & obj, T desired, std::memory_order order) noexcept -+{ -+ __atomic_store(&obj, &desired, (int)order); -+} ++static_assert( (__ATOMIC_RELAXED == to_underlying(std::memory_order_relaxed) ) ++ && (__ATOMIC_CONSUME == to_underlying(std::memory_order_consume) ) ++ && (__ATOMIC_ACQUIRE == to_underlying(std::memory_order_acquire) ) ++ && (__ATOMIC_RELEASE == to_underlying(std::memory_order_release) ) ++ && (__ATOMIC_ACQ_REL == to_underlying(std::memory_order_acq_rel) ) ++ && (__ATOMIC_SEQ_CST == to_underlying(std::memory_order_seq_cst) ) ++ , "Error: std::memory_order values are not equivalent to builtins" ++ ); + -+template -+T exchange(T & obj, T desired, std::memory_order order) noexcept -+{ -+ return __atomic_exchange_n(&obj, desired, (int)order); -+} ++namespace Impl { + ++//------------------------------------------------------------------------------ +template -+bool compare_exchange_weak(T & obj, T & expected, T desired, std::memory_order success, std::memory_order failure) noexcept -+{ -+ return __atomic_compare_exchange(&obj, &expected, &desired, true, (int)success, (int)failure); -+} ++inline constexpr size_t atomic_ref_required_alignment_v = sizeof(T) == sizeof(uint8_t) ? sizeof(uint8_t) ++ : sizeof(T) == sizeof(uint16_t) ? sizeof(uint16_t) ++ : sizeof(T) == sizeof(uint32_t) ? sizeof(uint32_t) ++ : sizeof(T) == sizeof(uint64_t) ? sizeof(uint64_t) ++ : std::alignment_of_v ++ ; + +template -+bool compare_exchange_strong(T & obj, T & expected, T desired, std::memory_order success, std::memory_order failure) noexcept -+{ -+ return __atomic_compare_exchange(&obj, &expected, &desired, false, (int)success, (int)failure); -+} ++inline constexpr bool atomic_use_native_ops_v = sizeof(T) <= sizeof(uint64_t) ++ && ( std::is_integral_v ++ || std::is_enum_v ++ || std::is_pointer_v ++ ) ++ ; + +template -+T fetch_add(T & obj, T arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_add(&obj, arg, (int)order); -+} ++inline constexpr bool atomic_use_cast_ops_v = !atomic_use_native_ops_v ++ && ( sizeof(T) == sizeof(uint8_t) ++ || sizeof(T) == sizeof(uint16_t) ++ || sizeof(T) == sizeof(uint32_t) ++ || sizeof(T) == sizeof(uint64_t) ++ ) ++ ; + +template -+T fetch_sub(T & obj, T arg, std::memory_order order) noexcept ++using atomic_ref_cast_t = std::conditional_t< sizeof(T) == sizeof(uint8_t), uint8_t ++ , std::conditional_t< sizeof(T) == sizeof(uint16_t), uint16_t ++ , std::conditional_t< sizeof(T) == sizeof(uint32_t), uint32_t ++ , std::conditional_t< sizeof(T) == sizeof(uint64_t), uint64_t ++ , T ++ >>>> ++ ; ++ ++//------------------------------------------------------------------------------ ++// atomic_ref_ops: generic ++//------------------------------------------------------------------------------ ++template ++struct atomic_ref_ops ++{}; ++ ++ ++//------------------------------------------------------------------------------ ++// atomic_ref_ops: integral ++//------------------------------------------------------------------------------ ++template ++struct atomic_ref_ops< Base, ValueType ++ , std::enable_if_t< std::is_integral_v ++ && !std::is_same_v ++ > ++ > +{ -+ return __atomic_fetch_sub(&obj, arg, (int)order); -+} -+ -+template -+T fetch_and(T & obj, T arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_and(&obj, arg, order); -+} -+ -+template -+T fetch_or(T & obj, T arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_or(&obj, arg, (int)order); -+} -+ -+template -+T fetch_xor(T & obj, T arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_xor(&obj, arg, (int)order); -+} -+ -+template -+auto fetch_add(T * & obj, std::ptrdiff_t arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_add(&obj, arg * sizeof(T), (int)order); -+} -+ -+template -+auto fetch_sub(T * & obj, std::ptrdiff_t arg, std::memory_order order) noexcept -+{ -+ return __atomic_fetch_sub(&obj, arg * sizeof(T), (int)order); -+} -+ -+} -+} -+ -+// INCLUDE: https://github.com/avakar/atomic_ref/blob/bf1b16afbf3c98754d33fd601c3e53b892cd7cab/include/avakar/atomic_ref.h -+#include -+#include -+ -+namespace avakar { ++ public: ++ using difference_type = ValueType; ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_add( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return __atomic_fetch_add( static_cast(this)->ptr_ ++ , val ++ , to_underlying(order) ++ ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_sub( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return __atomic_fetch_sub( static_cast(this)->ptr_ ++ , val ++ , to_underlying(order) ++ ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_and( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return __atomic_fetch_and( static_cast(this)->ptr_ ++ , val ++ , to_underlying(order) ++ ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_or( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return __atomic_fetch_or( static_cast(this)->ptr_ ++ , val ++ , to_underlying(order) ++ ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_xor( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return __atomic_fetch_xor( static_cast(this)->ptr_ ++ , val ++ , to_underlying(order) ++ ); ++ } ++ ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator++(int) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_fetch_add( static_cast(this)->ptr_, static_cast(1), to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator--(int) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_fetch_sub( static_cast(this)->ptr_, static_cast(1), to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator++() const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_add_fetch( static_cast(this)->ptr_, static_cast(1), to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator--() const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_sub_fetch( static_cast(this)->ptr_, static_cast(1), to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator+=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_add_fetch( static_cast(this)->ptr_, val, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator-=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_sub_fetch( static_cast(this)->ptr_, val, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator&=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_sub_fetch( static_cast(this)->ptr_, val, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator|=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_or_fetch( static_cast(this)->ptr_, val, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator^=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_xor_fetch( static_cast(this)->ptr_, val, to_underlying(order) ); ++ } ++}; + -+template -+struct _atomic_ref; + -+template -+using safe_atomic_ref = _atomic_ref; -+ -+template -+struct atomic_ref -+ : _atomic_ref ++//------------------------------------------------------------------------------ ++// atomic_ref_ops: floating-point ++//------------------------------------------------------------------------------ ++template ++struct atomic_ref_ops< Base, ValueType ++ , std::enable_if_t< std::is_floating_point_v > ++ > +{ -+ using difference_type = typename _atomic_ref::difference_type; -+ -+ explicit atomic_ref(T & obj) -+ : _atomic_ref(obj) -+ { -+ } -+ -+ operator T() const noexcept -+ { -+ return this->load(); -+ } -+ -+ T operator=(T desired) const noexcept -+ { -+ this->store(desired); -+ return desired; -+ } -+ -+ T operator++() const noexcept -+ { -+ return this->fetch_add(1) + T(1); -+ } -+ -+ T operator++(int) const noexcept -+ { -+ return this->fetch_add(1); -+ } -+ -+ T operator--() const noexcept -+ { -+ return this->fetch_sub(1) - T(1); -+ } -+ -+ T operator--(int) const noexcept -+ { -+ return this->fetch_sub(1); -+ } -+ -+ T operator+=(difference_type arg) const noexcept -+ { -+ return this->fetch_add(arg) + arg; -+ } -+ -+ T operator-=(difference_type arg) const noexcept -+ { -+ return this->fetch_sub(arg) - arg; -+ } -+ -+ T operator&=(T arg) const noexcept -+ { -+ return this->fetch_and(arg) & arg; -+ } -+ -+ T operator|=(T arg) const noexcept -+ { -+ return this->fetch_or(arg) | arg; -+ } -+ -+ T operator^=(T arg) const noexcept -+ { -+ return this->fetch_xor(arg) ^ arg; -+ } ++ public: ++ using difference_type = ValueType; ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_add( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ difference_type expected = static_cast(this)->load(std::memory_order_relaxed); ++ difference_type desired = expected + val; ++ ++ while (! static_cast(this)-> ++ compare_exchange_weak( expected ++ , desired ++ , order ++ , std::memory_order_relaxed ++ ) ++ ) ++ { ++ desired = expected + val; ++ if (std::isnan(expected)) break; ++ } ++ ++ return expected; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type fetch_sub( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ difference_type expected = static_cast(this)->load(std::memory_order_relaxed); ++ difference_type desired = expected - val; ++ ++ while (! static_cast(this)-> ++ compare_exchange_weak( expected ++ , desired ++ , order ++ , std::memory_order_relaxed ++ ) ++ ) ++ { ++ desired = expected - val; ++ if (std::isnan(expected)) break; ++ } ++ ++ return expected; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator+=(difference_type val) const noexcept ++ { ++ return fetch_add( val ) + val; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator-=(difference_type val) const noexcept ++ { ++ return fetch_sub( val ) - val; ++ } +}; + + -+template -+struct _atomic_ref ++//------------------------------------------------------------------------------ ++// atomic_ref_ops: pointer to object ++//------------------------------------------------------------------------------ ++template ++struct atomic_ref_ops< Base, ValueType ++ , std::enable_if< std::is_pointer_v ++ && std::is_object_v< std::remove_pointer_t> ++ > ++ > +{ -+ static_assert(std::is_trivially_copyable::value, "T must be TriviallyCopyable"); -+ -+ static constexpr bool is_always_lock_free = _avakar::atomic_ref::is_always_lock_free::value; -+ static constexpr bool is_always_wait_free = _avakar::atomic_ref::is_always_wait_free::value; -+ static constexpr std::size_t required_alignment = alignof(T); -+ -+ using value_type = T; -+ -+ explicit _atomic_ref(value_type & obj) -+ : _obj(obj) -+ { -+ } -+ -+ value_type load(std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::load(_obj, order); -+ } -+ -+ void store(value_type desired, std::memory_order order = std::memory_order_seq_cst) noexcept -+ { -+ _avakar::atomic_ref::store(_obj, desired, order); -+ } -+ -+ value_type exchange(value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::exchange(_obj, desired, order); -+ } -+ -+ bool compare_exchange_weak(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_weak(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_weak( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_weak(_obj, expected, desired, success, failure); -+ } -+ -+ bool compare_exchange_strong(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_strong(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_strong( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_strong(_obj, expected, desired, success, failure); -+ } -+ -+ _atomic_ref & operator=(_atomic_ref const &) = delete; -+ -+private: -+ value_type & _obj; ++ static constexpr ptrdiff_t stride = static_cast(sizeof( std::remove_pointer_t )); ++ ++ public: ++ using difference_type = ptrdiff_t; ++ ++ ATOMIC_REF_FORCEINLINE ++ ValueType fetch_add( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return val >= 0 ++ ? __atomic_fetch_add( static_cast(this)->ptr_ ++ , stride*val ++ , to_underlying(order) ++ ) ++ : __atomic_fetch_sub( static_cast(this)->ptr_ ++ , -(stride*val) ++ , to_underlying(order) ++ ) ++ ; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ ValueType fetch_sub( difference_type val ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return val >= 0 ++ ? __atomic_fetch_sub( static_cast(this)->ptr_ ++ , stride*val ++ , to_underlying(order) ++ ) ++ : __atomic_fetch_add( static_cast(this)->ptr_ ++ , -(stride*val) ++ , to_underlying(order) ++ ) ++ ; ++ } ++ ++ ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator++(int) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_fetch_add( static_cast(this)->ptr_, stride, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator--(int) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_fetch_sub( static_cast(this)->ptr_, stride, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator++() const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_add_fetch( static_cast(this)->ptr_, stride, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator--() const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return __atomic_sub_fetch( static_cast(this)->ptr_, stride, to_underlying(order) ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator+=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return val >= 0 ++ ? __atomic_fetch_add( static_cast(this)->ptr_ ++ , stride*val ++ , to_underlying(order) ++ ) ++ : __atomic_fetch_sub( static_cast(this)->ptr_ ++ , -(stride*val) ++ , to_underlying(order) ++ ) ++ ; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ difference_type operator-=(difference_type val) const noexcept ++ { ++ constexpr auto order = std::memory_order_seq_cst; ++ return val >= 0 ++ ? __atomic_fetch_sub( static_cast(this)->ptr_ ++ , stride*val ++ , to_underlying(order) ++ ) ++ : __atomic_fetch_add( static_cast(this)->ptr_ ++ , -(stride*val) ++ , to_underlying(order) ++ ) ++ ; ++ } +}; + -+template -+struct _atomic_ref -+{ -+ static_assert(std::is_trivially_copyable::value, "T must be TriviallyCopyable"); -+ -+ static constexpr bool is_always_lock_free = _avakar::atomic_ref::is_always_lock_free::value; -+ static constexpr bool is_always_wait_free = _avakar::atomic_ref::is_always_wait_free::value; -+ static constexpr std::size_t required_alignment = alignof(T); -+ -+ using value_type = T *; -+ using difference_type = std::ptrdiff_t; -+ -+ explicit _atomic_ref(value_type & obj) -+ : _obj(obj) -+ { -+ } -+ -+ value_type load(std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::load(_obj, order); -+ } -+ -+ void store(value_type desired, std::memory_order order = std::memory_order_seq_cst) noexcept -+ { -+ _avakar::atomic_ref::store(_obj, desired, order); -+ } -+ -+ value_type exchange(value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::exchange(_obj, desired, order); -+ } -+ -+ bool compare_exchange_weak(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_weak(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_weak( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_weak(_obj, expected, desired, success, failure); -+ } -+ -+ bool compare_exchange_strong(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_strong(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_strong( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_strong(_obj, expected, desired, success, failure); -+ } -+ -+ value_type fetch_add(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_add(_obj, arg, order); -+ } -+ -+ value_type fetch_sub(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_sub(_obj, arg, order); -+ } -+ -+ _atomic_ref & operator=(_atomic_ref const &) = delete; -+ -+private: -+ value_type & _obj; -+}; ++} // namespace Impl + -+template -+struct _atomic_ref::value>> ++template < class T > ++struct atomic_ref ++ : public Impl::atomic_ref_ops< atomic_ref, T > +{ -+ static_assert(std::is_trivially_copyable::value, "T must be TriviallyCopyable"); -+ -+ static constexpr bool is_always_lock_free = _avakar::atomic_ref::is_always_lock_free::value; -+ static constexpr bool is_always_wait_free = _avakar::atomic_ref::is_always_wait_free::value; -+ static constexpr std::size_t required_alignment = alignof(T); -+ -+ using value_type = T; -+ using difference_type = T; -+ -+ explicit _atomic_ref(value_type & obj) -+ : _obj(obj) -+ { -+ } -+ -+ value_type load(std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::load(_obj, order); -+ } -+ -+ void store(value_type desired, std::memory_order order = std::memory_order_seq_cst) noexcept -+ { -+ _avakar::atomic_ref::store(_obj, desired, order); -+ } -+ -+ value_type exchange(value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::exchange(_obj, desired, order); -+ } -+ -+ bool compare_exchange_weak(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_weak(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_weak( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_weak(_obj, expected, desired, success, failure); -+ } -+ -+ bool compare_exchange_strong(value_type & expected, value_type desired, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return this->compare_exchange_strong(expected, desired, order, order); -+ } -+ -+ bool compare_exchange_strong( -+ value_type & expected, value_type desired, -+ std::memory_order success, -+ std::memory_order failure) const noexcept -+ { -+ return _avakar::atomic_ref::compare_exchange_strong(_obj, expected, desired, success, failure); -+ } -+ -+ value_type fetch_add(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_add(_obj, arg, order); -+ } -+ -+ value_type fetch_sub(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_sub(_obj, arg, order); -+ } -+ -+ value_type fetch_and(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_and(_obj, arg, order); -+ } -+ -+ value_type fetch_or(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_or(_obj, arg, order); -+ } -+ -+ value_type fetch_xor(difference_type arg, std::memory_order order = std::memory_order_seq_cst) const noexcept -+ { -+ return _avakar::atomic_ref::fetch_xor(_obj, arg, order); -+ } -+ -+ _atomic_ref & operator=(_atomic_ref const &) = delete; ++ static_assert( std::is_trivially_copyable_v ++ , "Error: atomic_ref requires T to be trivially copyable"); + +private: -+ value_type & _obj; ++ T* ptr_; ++ ++ friend struct Impl::atomic_ref_ops< atomic_ref, T>; ++ ++public: ++ ++ using value_type = T; ++ ++ static constexpr size_t required_alignment = Impl::atomic_ref_required_alignment_v; ++ static constexpr bool is_always_lock_free = __atomic_always_lock_free( sizeof(T) <= required_alignment ++ ? required_alignment ++ : sizeof(T) ++ , nullptr ++ ); ++ ++ atomic_ref() = delete; ++ atomic_ref & operator=( const atomic_ref & ) = delete; ++ ++ ATOMIC_REF_FORCEINLINE ++ explicit atomic_ref( value_type & obj ) ++ : ptr_{&obj} ++ {} ++ ++ ATOMIC_REF_FORCEINLINE ++ atomic_ref( const atomic_ref & ref ) noexcept = default; ++ ++ ATOMIC_REF_FORCEINLINE ++ value_type operator=( value_type desired ) const noexcept ++ { ++ store(desired); ++ return desired; ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ operator value_type() const noexcept ++ { ++ return load(); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ bool is_lock_free() const noexcept ++ { ++ return __atomic_is_lock_free( sizeof(value_type), ptr_ ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ void store( value_type desired ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ if constexpr ( Impl::atomic_use_native_ops_v ) { ++ __atomic_store_n( ptr_, desired, to_underlying(order) ); ++ } ++ else if constexpr ( Impl::atomic_use_cast_ops_v ) { ++ typedef Impl::atomic_ref_cast_t __attribute__((__may_alias__)) cast_type; ++ ++ __atomic_store_n( reinterpret_cast(ptr_) ++ , *reinterpret_cast(&desired) ++ , to_underlying(order) ++ ); ++ } ++ else { ++ __atomic_store( ptr_, &desired, to_underlying(order) ); ++ } ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ value_type load( std::memory_order order = std::memory_order_seq_cst ) const noexcept ++ { ++ if constexpr ( Impl::atomic_use_native_ops_v ) { ++ return __atomic_load_n( ptr_, to_underlying(order) ); ++ } ++ else if constexpr ( Impl::atomic_use_cast_ops_v ) { ++ typedef Impl::atomic_ref_cast_t __attribute__((__may_alias__)) cast_type; ++ ++ cast_type tmp = __atomic_load_n( reinterpret_cast(ptr_) ++ , to_underlying(order) ++ ); ++ return *reinterpret_cast(&tmp); ++ } ++ else { ++ value_type result; ++ __atomic_load( ptr_, &result, to_underlying(order) ); ++ return result; ++ } ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ value_type exchange( value_type desired ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ if constexpr ( Impl::atomic_use_native_ops_v ) { ++ return __atomic_exchange_n( ptr_, desired, to_underlying(order) ); ++ } ++ else if constexpr ( Impl::atomic_use_cast_ops_v ) { ++ typedef Impl::atomic_ref_cast_t __attribute__((__may_alias__)) cast_type; ++ ++ cast_type tmp = __atomic_exchange_n( reinterpret_cast(ptr_) ++ , *reinterpret_cast(&desired) ++ , to_underlying(order) ++ ); ++ return *reinterpret_cast(&tmp); ++ } ++ else { ++ value_type result; ++ __atomic_exchange( ptr_, &desired, &result, to_underlying(order)); ++ return result; ++ } ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ bool compare_exchange_weak( value_type& expected ++ , value_type desired ++ , std::memory_order success ++ , std::memory_order failure ++ ) const noexcept ++ { ++ if constexpr ( Impl::atomic_use_native_ops_v ) { ++ return __atomic_compare_exchange_n( ptr_, &expected, desired, true, to_underlying(success), to_underlying(success) ); ++ } ++ else if constexpr ( Impl::atomic_use_cast_ops_v ) { ++ typedef Impl::atomic_ref_cast_t __attribute__((__may_alias__)) cast_type; ++ ++ return __atomic_compare_exchange_n( reinterpret_cast(ptr_) ++ , reinterpret_cast(&expected) ++ , *reinterpret_cast(&desired) ++ , true ++ , to_underlying(success) ++ , to_underlying(failure) ++ ); ++ } ++ else { ++ return __atomic_compare_exchange( ptr_, &expected, &desired, true, to_underlying(success), to_underlying(failure) ); ++ } ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ bool compare_exchange_strong( value_type& expected ++ , value_type desired ++ , std::memory_order success ++ , std::memory_order failure ++ ) const noexcept ++ { ++ if constexpr ( Impl::atomic_use_native_ops_v ) { ++ return __atomic_compare_exchange_n( ptr_, &expected, desired, false, to_underlying(success), to_underlying(failure) ); ++ } ++ else if constexpr ( Impl::atomic_use_cast_ops_v ) { ++ typedef Impl::atomic_ref_cast_t __attribute__((__may_alias__)) cast_type; ++ ++ return __atomic_compare_exchange_n( reinterpret_cast(ptr_) ++ , reinterpret_cast(&expected) ++ , *reinterpret_cast(&desired) ++ , false ++ , to_underlying(success) ++ , to_underlying(failure) ++ ); ++ } ++ else { ++ return __atomic_compare_exchange( ptr_, &expected, &desired, false, to_underlying(success), to_underlying(failure) ); ++ } ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ bool compare_exchange_weak( value_type& expected ++ , value_type desired ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return compare_exchange_weak( expected, desired, order, order ); ++ } ++ ++ ATOMIC_REF_FORCEINLINE ++ bool compare_exchange_strong( value_type& expected ++ , value_type desired ++ , std::memory_order order = std::memory_order_seq_cst ++ ) const noexcept ++ { ++ return compare_exchange_strong( expected, desired, order, order ); ++ } +}; + -+} ++} // namespace Foo ++ ++#pragma GCC diagnostic pop + +#endif // TERMUX_HEADER_ONLY_ATOMIC_REF_POLYFILL_H --- a/base/atomicops.cc @@ -448,7 +619,7 @@ +#ifdef __TERMUX__ +#include "base/__termux_header_only_atomic_ref_polyfill.h" +template -+using __my_atomic_ref = avakar::safe_atomic_ref; ++using __my_atomic_ref = Foo::atomic_ref; +#else +template +using __my_atomic_ref = std::atomic_ref; diff --git a/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch b/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch new file mode 100644 index 0000000..dde3901 --- /dev/null +++ b/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch @@ -0,0 +1,27 @@ +https://github.com/llvm/llvm-project/issues/132013 +https://github.com/google/XNNPACK/commit/8a2f5f441833b80806b58b5d704ec8335634182c + +--- a/third_party/xnnpack/src/src/xnnpack/simd/f16-avx512fp16.h ++++ b/third_party/xnnpack/src/src/xnnpack/simd/f16-avx512fp16.h +@@ -27,8 +27,21 @@ typedef __m512h xnn_simd_f16_t; + const xnn_simd_f16_t var = _mm512_castsi512_ph(_mm512_set1_epi16(val)); + + #if XNN_HAVE_FLOAT16 ++ ++#if defined(__clang__) && (__clang_major__ < 19) ++static XNN_INLINE __m512d xnn_broadcast_16_512_workaround(uint16_t x) { ++ uint32_t bits = (uint32_t)x | ((uint32_t)x) << 16; ++ __asm__ volatile("" : "=m"(bits) : "m"(bits)); ++ return _mm512_castsi512_pd(_mm512_set1_epi32(bits)); ++} ++#define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ ++ const xnn_simd_f16_t var = xnn_broadcast_16_512_workaround( \ ++ xnn_float16_to_bits(xnn_float16_from_float(val))) ++#else + #define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ + const xnn_simd_f16_t var = _mm512_set1_ph(xnn_float16_from_float(val)) ++#endif // Old Clang workaround ++ + #else + #define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ + XNN_SIMD_CONST_F16_FROM_INT16( \ diff --git a/tur-chromium/chromium-stable/build.sh b/tur-chromium/chromium-stable/build.sh index 0af4ecd..afb9b7e 100644 --- a/tur-chromium/chromium-stable/build.sh +++ b/tur-chromium/chromium-stable/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://www.chromium.org/Home TERMUX_PKG_DESCRIPTION="Chromium web browser" TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="Chongyun Lee " -TERMUX_PKG_VERSION=135.0.7049.114 +TERMUX_PKG_VERSION=136.0.7103.59 TERMUX_PKG_SRCURL=https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$TERMUX_PKG_VERSION.tar.xz -TERMUX_PKG_SHA256=aa85ce2bf36ed71261109fd7e700fac596a28b7be035a40a518c6a6fcf973c22 +TERMUX_PKG_SHA256=3ce1ef863767b3a72058a0f0ceb150cc7b8a9ba8bc24e19c98d25f8b395a8cfe TERMUX_PKG_DEPENDS="atk, cups, dbus, fontconfig, gtk3, krb5, libc++, libdrm, libevdev, libxkbcommon, libminizip, libnss, libwayland, libx11, mesa, openssl, pango, pulseaudio, zlib" TERMUX_PKG_BUILD_DEPENDS="libffi-static" # Chromium doesn't support i686 on Linux. @@ -24,7 +24,6 @@ termux_step_post_get_source() { termux_step_configure() { cd $TERMUX_PKG_SRCDIR termux_setup_ninja - termux_setup_nodejs # Fetch depot_tools export DEPOT_TOOLS_UPDATE=0 @@ -33,6 +32,7 @@ termux_step_configure() { touch "$TERMUX_PKG_CACHEDIR/.depot_tools-fetched" fi export PATH="$TERMUX_PKG_CACHEDIR/depot_tools:$PATH" + $TERMUX_PKG_CACHEDIR/depot_tools/ensure_bootstrap # Remove termux's dummy pkg-config local _target_pkg_config=$(command -v pkg-config) @@ -43,8 +43,6 @@ termux_step_configure() { export PATH="$TERMUX_PKG_CACHEDIR/host-pkg-config-bin:$PATH" # Install amd64 rootfs and deps - env -i PATH="$PATH" sudo apt update - env -i PATH="$PATH" sudo apt install libfontconfig1 libcups2-dev -yq build/linux/sysroot_scripts/install-sysroot.py --arch=amd64 local _amd64_sysroot_path="$(pwd)/build/linux/$(ls build/linux | grep 'amd64-sysroot')" @@ -58,10 +56,14 @@ termux_step_configure() { fi # Link to system tools required by the build - mkdir -p third_party/node/linux/node-linux-x64/bin - ln -sf $(command -v node) third_party/node/linux/node-linux-x64/bin/ + mkdir -p third_party/jdk/current/bin ln -sf $(command -v java) third_party/jdk/current/bin/ + # Install nodejs + if [ ! -f "third_party/node/linux/node-linux-x64/bin/node" ]; then + ./third_party/node/update_node_binaries + fi + # Dummy librt.so # Why not dummy a librt.a? Some of the binaries reference symbols only exists in Android # for some reason, such as the `chrome_crashpad_handler`, which needs to link with @@ -116,7 +118,6 @@ termux_step_configure() { _v8_toolchain_name="host" elif [ "$TERMUX_ARCH" = "arm" ]; then # Install i386 rootfs and deps - env -i PATH="$PATH" sudo apt install libfontconfig1:i386 libexpat1:i386 libglib2.0-0t64:i386 -yq build/linux/sysroot_scripts/install-sysroot.py --arch=i386 local _i386_sysroot_path="$(pwd)/build/linux/$(ls build/linux | grep 'i386-sysroot')" _target_cpu="arm"