All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] mozjs: Drop using JS_VOLATILE_ARM
@ 2021-03-03 19:11 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2021-03-03 19:11 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj, Andreas Müller

JS_VOLATILE_ARM was a workaround for a gcc 4.7 bug on B2G where it
would generate unaligned word accesses that should have been
individual byte accesses.  firefox now a days require at least gcc 6.1+ (and ARM
systems support unaligned accesses). see [1]

in gcc11 volatile wont be accepted as argument qualifier in functions,
hence the build breaks, this patch unbreaks it

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1495731

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andreas Müller <schnitzeltony@gmail.com>
---
 .../mozjs/0014-remove-JS_VOLATIME_ARM.patch   | 111 ++++++++++++++++++
 .../recipes-extended/mozjs/mozjs_60.9.0.bb    |   1 +
 2 files changed, 112 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-remove-JS_VOLATIME_ARM.patch

diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-remove-JS_VOLATIME_ARM.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-remove-JS_VOLATIME_ARM.patch
new file mode 100644
index 0000000000..a20873cb0b
--- /dev/null
+++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-remove-JS_VOLATIME_ARM.patch
@@ -0,0 +1,111 @@
+# HG changeset patch
+# User Lars T Hansen <lhansen@mozilla.com>
+# Date 1538489772 -7200
+# Node ID bb430eaf5521aa8ab233a45b585ff9e5dfecf4c9
+# Parent  e87d7028568e721e8d297ce62f9622e74d29bb37
+Bug 1495731 - remove JS_VOLATILE_ARM, it is no longer relevant.  r=waldo
+
+JS_VOLATILE_ARM was a workaround for a gcc 4.7 bug on B2G where it
+would generate unaligned word accesses that should have been
+individual byte accesses.  We now require at least gcc 6.1 (and ARM
+systems support unaligned accesses).
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport [https://hg.mozilla.org/integration/mozilla-inbound/rev/bb430eaf5521]
+
+--- a/js/src/vm/TypedArrayObject-inl.h
++++ b/js/src/vm/TypedArrayObject-inl.h
+@@ -259,68 +259,61 @@ class ElementSpecific {
+       return true;
+     }
+ 
+-      // Inhibit unaligned accesses on ARM (bug 1097253, a compiler bug).
+-#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__)
+-#define JS_VOLATILE_ARM volatile
+-#else
+-#define JS_VOLATILE_ARM
+-#endif
+-
+     SharedMem<void*> data = Ops::extract(source);
+     switch (source->type()) {
+       case Scalar::Int8: {
+-        SharedMem<JS_VOLATILE_ARM int8_t*> src =
+-            data.cast<JS_VOLATILE_ARM int8_t*>();
++        SharedMem<int8_t*> src =
++            data.cast<int8_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Uint8:
+       case Scalar::Uint8Clamped: {
+-        SharedMem<JS_VOLATILE_ARM uint8_t*> src =
+-            data.cast<JS_VOLATILE_ARM uint8_t*>();
++        SharedMem<uint8_t*> src =
++            data.cast<uint8_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Int16: {
+-        SharedMem<JS_VOLATILE_ARM int16_t*> src =
+-            data.cast<JS_VOLATILE_ARM int16_t*>();
++        SharedMem<int16_t*> src =
++            data.cast<int16_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Uint16: {
+-        SharedMem<JS_VOLATILE_ARM uint16_t*> src =
+-            data.cast<JS_VOLATILE_ARM uint16_t*>();
++        SharedMem<uint16_t*> src =
++            data.cast<uint16_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Int32: {
+-        SharedMem<JS_VOLATILE_ARM int32_t*> src =
+-            data.cast<JS_VOLATILE_ARM int32_t*>();
++        SharedMem<int32_t*> src =
++            data.cast<int32_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Uint32: {
+-        SharedMem<JS_VOLATILE_ARM uint32_t*> src =
+-            data.cast<JS_VOLATILE_ARM uint32_t*>();
++        SharedMem<uint32_t*> src =
++            data.cast<uint32_t*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Float32: {
+-        SharedMem<JS_VOLATILE_ARM float*> src =
+-            data.cast<JS_VOLATILE_ARM float*>();
++        SharedMem<float*> src =
++            data.cast<float*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+       }
+       case Scalar::Float64: {
+-        SharedMem<JS_VOLATILE_ARM double*> src =
+-            data.cast<JS_VOLATILE_ARM double*>();
++        SharedMem<double*> src =
++            data.cast<double*>();
+         for (uint32_t i = 0; i < count; ++i)
+           Ops::store(dest++, ConvertNumber<T>(Ops::load(src++)));
+         break;
+@@ -329,8 +322,6 @@ class ElementSpecific {
+         MOZ_CRASH("setFromTypedArray with a typed array with bogus type");
+     }
+ 
+-#undef JS_VOLATILE_ARM
+-
+     return true;
+   }
+ 
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb
index 614cdf6e35..7367c30a5e 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb
+++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb
@@ -18,6 +18,7 @@ SRC_URI = " \
     file://0011-To-fix-build-error-on-arm32BE.patch \
     file://0012-JS_PUBLIC_API.patch \
     file://0013-riscv-Disable-atomic-operations.patch \
+    file://0014-remove-JS_VOLATIME_ARM.patch \
 "
 SRC_URI_append_libc-musl = " \
     file://musl/0001-support-musl.patch \
-- 
2.30.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-03 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 19:11 [meta-oe][PATCH] mozjs: Drop using JS_VOLATILE_ARM Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.