Adopt ARM patches from devel/protobuf; makes firefox work on NetBSD/evbarm

This commit is contained in:
jmcneill 2017-07-16 10:48:17 +00:00
parent fa93a76f4d
commit 1f9b754297
4 changed files with 188 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.4 2017/07/09 09:04:00 maya Exp $
# $NetBSD: Makefile,v 1.5 2017/07/16 10:48:17 jmcneill Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
PKGREVISION= 1
PKGREVISION= 2
MOZ_BRANCH= 52.2
MOZ_BRANCH_MINOR= .1esr

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.3 2017/07/03 16:26:59 ryoon Exp $
$NetBSD: distinfo,v 1.4 2017/07/16 10:48:17 jmcneill Exp $
SHA1 (firefox-52.2.1esr.source.tar.xz) = 38396fbc760669533f0a4facaa6ec489ae99f320
RMD160 (firefox-52.2.1esr.source.tar.xz) = 1904238678469340f519416e87b0de6971996f85
@ -44,6 +44,7 @@ SHA1 (patch-image_decoders_nsJPEGDecoder.cpp) = ed86c3fbb3aef753eec6f6a97940594a
SHA1 (patch-intl_hyphenation_glue_hnjalloc.h) = abe01bea5872a57f3d00bbbf89f958621f08a655
SHA1 (patch-intl_unicharutil_util_moz.build) = 2e604c8695b490657ee14cae01ca84d7bd51236c
SHA1 (patch-ipc_chromium_src_base_atomicops.h) = 24b63a6e51d9ab27f2788ee02f2ffa7e1c36f29a
SHA1 (patch-ipc_chromium_src_base_atomicops__internals__arm__gcc.h) = cceefce420cfcfc67f74375e3fe5d17a75a562e4
SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 99b9f3f9dd88f1c8008d2fb6058450695394f5cf
SHA1 (patch-ipc_chromium_src_base_platform__thread.h) = c81930280bd76a00fbad37aad02fb8451d80b1ee
SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 45409f2152d5ffc376c18c0c9bc696e08e3910ce
@ -88,6 +89,7 @@ SHA1 (patch-rc) = 9628b038f036f3fc0e37bdf84fa0abf99dbc8d2a
SHA1 (patch-toolkit_components_osfile_modules_osfile__unix__back.jsm) = 27e90fdfd5587f670958d832cd56107740b226ee
SHA1 (patch-toolkit_components_osfile_modules_osfile__unix__front.jsm) = 4e5dc7cf11ea3d48cca86b5d21158d676ebd8957
SHA1 (patch-toolkit_components_protobuf_src_google_protobuf_stubs_atomicops.h) = 5ffb0782bbbff2fd17ad71e98b349b4ec3dc6c8c
SHA1 (patch-toolkit_components_protobuf_src_google_protobuf_stubs_atomicops__internals__arm__gcc.h) = bc2bc37518fe76cb2aa8550c52d2c3968e08b9a6
SHA1 (patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform__macros.h) = bd4388323851fcb7b10392d6a27f9bc56633a52e
SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = 5b6d2e5c9f685d32894898d3ef3aec09a1a1e5ce
SHA1 (patch-toolkit_library_moz.build) = d4136a5d3c42f2a44155f029a3201959273c5e94

View file

@ -0,0 +1,92 @@
$NetBSD: patch-ipc_chromium_src_base_atomicops__internals__arm__gcc.h,v 1.1 2017/07/16 10:48:17 jmcneill Exp $
Replace Linux specific atomic ops with portable versions, from devel/protobuf
--- ipc/chromium/src/base/atomicops_internals_arm_gcc.h.orig 2017-04-11 02:13:12.000000000 +0000
+++ ipc/chromium/src/base/atomicops_internals_arm_gcc.h
@@ -14,44 +14,19 @@
namespace base {
namespace subtle {
-// 0xffff0fc0 is the hard coded address of a function provided by
-// the kernel which implements an atomic compare-exchange. On older
-// ARM architecture revisions (pre-v6) this may be implemented using
-// a syscall. This address is stable, and in active use (hard coded)
-// by at least glibc-2.7 and the Android C library.
-typedef Atomic32 (*LinuxKernelCmpxchgFunc)(Atomic32 old_value,
- Atomic32 new_value,
- volatile Atomic32* ptr);
-LinuxKernelCmpxchgFunc pLinuxKernelCmpxchg __attribute__((weak)) =
- (LinuxKernelCmpxchgFunc) 0xffff0fc0;
-
-typedef void (*LinuxKernelMemoryBarrierFunc)(void);
-LinuxKernelMemoryBarrierFunc pLinuxKernelMemoryBarrier __attribute__((weak)) =
- (LinuxKernelMemoryBarrierFunc) 0xffff0fa0;
-
-
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
- Atomic32 prev_value = *ptr;
- do {
- if (!pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr))) {
- return old_value;
- }
- prev_value = *ptr;
- } while (prev_value == old_value);
- return prev_value;
+ return __sync_val_compare_and_swap(ptr, old_value, new_value);
}
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
Atomic32 new_value) {
- Atomic32 old_value;
+ Atomic32 prev_value;
do {
- old_value = *ptr;
- } while (pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr)));
- return old_value;
+ prev_value = *ptr;
+ } while (!__sync_bool_compare_and_swap(ptr, prev_value, new_value));
+ return prev_value;
}
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
@@ -61,18 +36,15 @@ inline Atomic32 NoBarrier_AtomicIncremen
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
- for (;;) {
- // Atomic exchange the old value with an incremented one.
- Atomic32 old_value = *ptr;
- Atomic32 new_value = old_value + increment;
- if (pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr)) == 0) {
- // The exchange took place as expected.
- return new_value;
- }
- // Otherwise, *ptr changed mid-loop and we need to retry.
- }
+ Atomic32 old_value;
+ Atomic32 new_value;
+ do {
+ // Atomic exchange the old value with an incremented one.
+ old_value = *ptr;
+ new_value = old_value + increment;
+ } while (!__sync_bool_compare_and_swap(ptr, old_value, new_value));
+ return new_value;
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
@@ -92,7 +64,7 @@ inline void NoBarrier_Store(volatile Ato
}
inline void MemoryBarrier() {
- pLinuxKernelMemoryBarrier();
+ __sync_synchronize();
}
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {

View file

@ -0,0 +1,91 @@
$NetBSD: patch-toolkit_components_protobuf_src_google_protobuf_stubs_atomicops__internals__arm__gcc.h,v 1.1 2017/07/16 10:48:17 jmcneill Exp $
Replace Linux specific atomic ops with portable versions, from devel/protobuf
--- toolkit/components/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h.orig 2017-04-11 02:13:22.000000000 +0000
+++ toolkit/components/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
@@ -39,44 +39,19 @@ namespace google {
namespace protobuf {
namespace internal {
-// 0xffff0fc0 is the hard coded address of a function provided by
-// the kernel which implements an atomic compare-exchange. On older
-// ARM architecture revisions (pre-v6) this may be implemented using
-// a syscall. This address is stable, and in active use (hard coded)
-// by at least glibc-2.7 and the Android C library.
-typedef Atomic32 (*LinuxKernelCmpxchgFunc)(Atomic32 old_value,
- Atomic32 new_value,
- volatile Atomic32* ptr);
-LinuxKernelCmpxchgFunc pLinuxKernelCmpxchg __attribute__((weak)) =
- (LinuxKernelCmpxchgFunc) 0xffff0fc0;
-
-typedef void (*LinuxKernelMemoryBarrierFunc)(void);
-LinuxKernelMemoryBarrierFunc pLinuxKernelMemoryBarrier __attribute__((weak)) =
- (LinuxKernelMemoryBarrierFunc) 0xffff0fa0;
-
-
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
- Atomic32 prev_value = *ptr;
- do {
- if (!pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr))) {
- return old_value;
- }
- prev_value = *ptr;
- } while (prev_value == old_value);
- return prev_value;
+ return __sync_val_compare_and_swap(ptr, old_value, new_value);
}
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
Atomic32 new_value) {
- Atomic32 old_value;
+ Atomic32 prev_value;
do {
- old_value = *ptr;
- } while (pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr)));
- return old_value;
+ prev_value = *ptr;
+ } while (!__sync_bool_compare_and_swap(ptr, prev_value, new_value));
+ return prev_value;
}
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
@@ -86,17 +61,15 @@ inline Atomic32 NoBarrier_AtomicIncremen
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
- for (;;) {
+ Atomic32 old_value;
+ Atomic32 new_value;
+
+ do {
// Atomic exchange the old value with an incremented one.
- Atomic32 old_value = *ptr;
- Atomic32 new_value = old_value + increment;
- if (pLinuxKernelCmpxchg(old_value, new_value,
- const_cast<Atomic32*>(ptr)) == 0) {
- // The exchange took place as expected.
- return new_value;
- }
- // Otherwise, *ptr changed mid-loop and we need to retry.
- }
+ old_value = *ptr;
+ new_value = old_value + increment;
+ } while (!__sync_bool_compare_and_swap(ptr, old_value, new_value));
+ return new_value;
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
@@ -116,7 +89,7 @@ inline void NoBarrier_Store(volatile Ato
}
inline void MemoryBarrier() {
- pLinuxKernelMemoryBarrier();
+ __sync_synchronize();
}
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {