All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS
@ 2018-08-01  3:06 Ricardo Salveti
  2018-08-01  3:06 ` [PATCH 2/2] mozjs: add support for RISC-V Ricardo Salveti
  2018-08-02  8:34 ` [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Khem Raj
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Salveti @ 2018-08-01  3:06 UTC (permalink / raw)
  To: openembedded-devel

Mozjs fails to start on several architectures due broken build
optimizations when building with GCC >= 6.

Set -fno-schedule-insns2 as workaround (flag also used by Firefox and
Debian).

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---
 meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
index da80b63..adc27ac 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
+++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
@@ -30,6 +30,11 @@ CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
 
 DEPENDS += "nspr zlib"
 
+# Avoid broken JIT on several architectures (from Firefox and Debian)
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1245783
+CFLAGS += "-fno-schedule-insns2"
+CXXFLAGS += "-fno-schedule-insns2"
+
 # nspr's package-config is ignored so set libs manually
 EXTRA_OECONF = " \
     --target=${TARGET_SYS} \
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mozjs: add support for RISC-V
  2018-08-01  3:06 [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Ricardo Salveti
@ 2018-08-01  3:06 ` Ricardo Salveti
  2018-08-02  8:34 ` [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Khem Raj
  1 sibling, 0 replies; 6+ messages in thread
From: Ricardo Salveti @ 2018-08-01  3:06 UTC (permalink / raw)
  To: openembedded-devel

Based on pending patch that was already submitted at
https://bugzilla.mozilla.org/show_bug.cgi?id=1318905.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---
 .../mozjs/mozjs/add-riscv-support.patch            | 70 ++++++++++++++++++++++
 meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb     |  1 +
 2 files changed, 71 insertions(+)
 create mode 100644 meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch

diff --git a/meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch b/meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch
new file mode 100644
index 0000000..4354a9d
--- /dev/null
+++ b/meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch
@@ -0,0 +1,70 @@
+Add RISC-V support
+
+Upstream-Status: Submitted [https://bugzilla.mozilla.org/show_bug.cgi?id=1318905]
+
+Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
+
+diff --git a/build/autoconf/config.guess b/build/autoconf/config.guess
+index d5d667d..1277a86 100755
+--- a/build/autoconf/config.guess
++++ b/build/autoconf/config.guess
+@@ -1029,6 +1029,9 @@ EOF
+     ppcle:Linux:*:*)
+ 	echo powerpcle-unknown-linux-${LIBC}
+ 	exit ;;
++    riscv32:Linux:*:* | riscv64:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
++	exit ;;
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ 	exit ;;
+diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
+index 6fe6591..56e6730 100644
+--- a/build/moz.configure/init.configure
++++ b/build/moz.configure/init.configure
+@@ -362,6 +362,9 @@ def split_triplet(triplet):
+     elif cpu.startswith('aarch64'):
+         canonical_cpu = 'aarch64'
+         endianness = 'little'
++    elif cpu in ('riscv32', 'riscv64'):
++        canonical_cpu = cpu
++        endianness = 'little'
+     else:
+         die('Unknown CPU type: %s' % cpu)
+ 
+diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
+index 15dd4bf..4f37218 100644
+--- a/mfbt/double-conversion/utils.h
++++ b/mfbt/double-conversion/utils.h
+@@ -60,7 +60,8 @@
+     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
+     defined(__SH4__) || defined(__alpha__) || \
+     defined(_MIPS_ARCH_MIPS32R2) || \
+-    defined(__AARCH64EL__) || defined(__aarch64__)
++    defined(__AARCH64EL__) || defined(__aarch64__) || \
++    defined(__riscv)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
+ #if defined(_WIN32)
+diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
+index dfc7cf8..4f8d666 100644
+--- a/python/mozbuild/mozbuild/configure/constants.py
++++ b/python/mozbuild/mozbuild/configure/constants.py
+@@ -48,6 +48,8 @@ CPU_bitness = {
+     'mips64': 64,
+     'ppc': 32,
+     'ppc64': 64,
++    'riscv32': 32,
++    'riscv64': 64,
+     's390': 32,
+     's390x': 64,
+     'sparc': 32,
+@@ -79,6 +81,8 @@ CPU_preprocessor_checks = OrderedDict((
+     ('s390', '__s390__'),
+     ('ppc64', '__powerpc64__'),
+     ('ppc', '__powerpc__'),
++    ('riscv32', '__riscv && __SIZEOF_POINTER__ == 4'),
++    ('riscv64', '__riscv && __SIZEOF_POINTER__ == 8'),
+     ('Alpha', '__alpha__'),
+     ('hppa', '__hppa__'),
+     ('sparc64', '__sparc__ && __arch64__'),
diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
index adc27ac..b042674 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
+++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
@@ -12,6 +12,7 @@ SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/m/mozjs52/mozjs52_52.8.1.o
            file://0004-do-not-use-autoconf-2.13-to-refresh-old.configure.patch \
            file://0005-fix-do_compile-failed-on-mips.patch \
            file://disable-mozglue-in-stand-alone-builds.patch \
+           file://add-riscv-support.patch \
            "
 SRC_URI_append_libc-musl = " \
            file://0006-support-musl.patch \
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS
  2018-08-01  3:06 [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Ricardo Salveti
  2018-08-01  3:06 ` [PATCH 2/2] mozjs: add support for RISC-V Ricardo Salveti
@ 2018-08-02  8:34 ` Khem Raj
  2018-08-14 18:50   ` Andy
  1 sibling, 1 reply; 6+ messages in thread
From: Khem Raj @ 2018-08-02  8:34 UTC (permalink / raw)
  To: ricardo; +Cc: openembeded-devel

Hi Ricardo


On Tue, Jul 31, 2018 at 8:06 PM Ricardo Salveti <ricardo@foundries.io> wrote:
>
> Mozjs fails to start on several architectures due broken build
> optimizations when building with GCC >= 6.
>
> Set -fno-schedule-insns2 as workaround (flag also used by Firefox and
> Debian).
>
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> ---
>  meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> index da80b63..adc27ac 100644
> --- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> +++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> @@ -30,6 +30,11 @@ CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
>
>  DEPENDS += "nspr zlib"
>
> +# Avoid broken JIT on several architectures (from Firefox and Debian)
> +# https://bugzilla.mozilla.org/show_bug.cgi?id=1245783
> +CFLAGS += "-fno-schedule-insns2"
> +CXXFLAGS += "-fno-schedule-insns2"
> +

Could you test with -fno-tree-vrp -fno-strict-aliasing
-fno-delete-null-pointer-checks instead of -fno-schedule-insns2

>  # nspr's package-config is ignored so set libs manually
>  EXTRA_OECONF = " \
>      --target=${TARGET_SYS} \
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS
  2018-08-02  8:34 ` [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Khem Raj
@ 2018-08-14 18:50   ` Andy
  2018-08-16  2:17     ` Ricardo Salveti
  0 siblings, 1 reply; 6+ messages in thread
From: Andy @ 2018-08-14 18:50 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-devel

Hi,

Am Do., 2. Aug. 2018 um 10:34 Uhr schrieb Khem Raj <raj.khem@gmail.com>:
>
> Hi Ricardo
>
>
> On Tue, Jul 31, 2018 at 8:06 PM Ricardo Salveti <ricardo@foundries.io> wrote:
> >
> > Mozjs fails to start on several architectures due broken build
> > optimizations when building with GCC >= 6.
> >
> > Set -fno-schedule-insns2 as workaround (flag also used by Firefox and
> > Debian).
> >
> > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> > ---
> >  meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> > index da80b63..adc27ac 100644
> > --- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> > +++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> > @@ -30,6 +30,11 @@ CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
> >
> >  DEPENDS += "nspr zlib"
> >
> > +# Avoid broken JIT on several architectures (from Firefox and Debian)
> > +# https://bugzilla.mozilla.org/show_bug.cgi?id=1245783
> > +CFLAGS += "-fno-schedule-insns2"
> > +CXXFLAGS += "-fno-schedule-insns2"
> > +
>
> Could you test with -fno-tree-vrp -fno-strict-aliasing
> -fno-delete-null-pointer-checks instead of -fno-schedule-insns2
>

at least polkit is able to start again using

CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"

before I got:
Assertion failure: !joinable()
in cortexa7t2hf-neon-poky-linux-gnueabi/mozjs/52.8.1-r0/mozjs-52.8.1/js/src/threading/Thread.h:122

Andy


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS
  2018-08-14 18:50   ` Andy
@ 2018-08-16  2:17     ` Ricardo Salveti
  2018-08-16  2:27       ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Salveti @ 2018-08-16  2:17 UTC (permalink / raw)
  To: Andy; +Cc: openembedded-devel

On Tue, Aug 14, 2018 at 3:50 PM, Andy <andreas.kling@gmail.com> wrote:
> Hi,
>
> Am Do., 2. Aug. 2018 um 10:34 Uhr schrieb Khem Raj <raj.khem@gmail.com>:
>>
>> Hi Ricardo
>>
>>
>> On Tue, Jul 31, 2018 at 8:06 PM Ricardo Salveti <ricardo@foundries.io> wrote:
>> >
>> > Mozjs fails to start on several architectures due broken build
>> > optimizations when building with GCC >= 6.
>> >
>> > Set -fno-schedule-insns2 as workaround (flag also used by Firefox and
>> > Debian).
>> >
>> > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
>> > ---
>> >  meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb | 5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
>> > index da80b63..adc27ac 100644
>> > --- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
>> > +++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
>> > @@ -30,6 +30,11 @@ CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
>> >
>> >  DEPENDS += "nspr zlib"
>> >
>> > +# Avoid broken JIT on several architectures (from Firefox and Debian)
>> > +# https://bugzilla.mozilla.org/show_bug.cgi?id=1245783
>> > +CFLAGS += "-fno-schedule-insns2"
>> > +CXXFLAGS += "-fno-schedule-insns2"
>> > +
>>
>> Could you test with -fno-tree-vrp -fno-strict-aliasing
>> -fno-delete-null-pointer-checks instead of -fno-schedule-insns2
>>
>
> at least polkit is able to start again using
>
> CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
> CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
>
> before I got:
> Assertion failure: !joinable()
> in cortexa7t2hf-neon-poky-linux-gnueabi/mozjs/52.8.1-r0/mozjs-52.8.1/js/src/threading/Thread.h:122

Finally able to test this locally across multiple builds, and these
flags seems to be working fine as well.

Looking around and it seems fedora is also using the flags you
suggested, should we use them instead of '-fno-schedule-insns2'? If
so, I can prepare another patch with the new changes.

Thanks,
-- 
Ricardo Salveti


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS
  2018-08-16  2:17     ` Ricardo Salveti
@ 2018-08-16  2:27       ` Khem Raj
  0 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2018-08-16  2:27 UTC (permalink / raw)
  To: ricardo; +Cc: Andy Kling, openembeded-devel

On Wed, Aug 15, 2018 at 7:18 PM Ricardo Salveti <ricardo@foundries.io> wrote:
>
> On Tue, Aug 14, 2018 at 3:50 PM, Andy <andreas.kling@gmail.com> wrote:
> > Hi,
> >
> > Am Do., 2. Aug. 2018 um 10:34 Uhr schrieb Khem Raj <raj.khem@gmail.com>:
> >>
> >> Hi Ricardo
> >>
> >>
> >> On Tue, Jul 31, 2018 at 8:06 PM Ricardo Salveti <ricardo@foundries.io> wrote:
> >> >
> >> > Mozjs fails to start on several architectures due broken build
> >> > optimizations when building with GCC >= 6.
> >> >
> >> > Set -fno-schedule-insns2 as workaround (flag also used by Firefox and
> >> > Debian).
> >> >
> >> > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> >> > ---
> >> >  meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb | 5 +++++
> >> >  1 file changed, 5 insertions(+)
> >> >
> >> > diff --git a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> >> > index da80b63..adc27ac 100644
> >> > --- a/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> >> > +++ b/meta-oe/recipes-extended/mozjs/mozjs_52.8.1.bb
> >> > @@ -30,6 +30,11 @@ CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
> >> >
> >> >  DEPENDS += "nspr zlib"
> >> >
> >> > +# Avoid broken JIT on several architectures (from Firefox and Debian)
> >> > +# https://bugzilla.mozilla.org/show_bug.cgi?id=1245783
> >> > +CFLAGS += "-fno-schedule-insns2"
> >> > +CXXFLAGS += "-fno-schedule-insns2"
> >> > +
> >>
> >> Could you test with -fno-tree-vrp -fno-strict-aliasing
> >> -fno-delete-null-pointer-checks instead of -fno-schedule-insns2
> >>
> >
> > at least polkit is able to start again using
> >
> > CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
> > CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
> >
> > before I got:
> > Assertion failure: !joinable()
> > in cortexa7t2hf-neon-poky-linux-gnueabi/mozjs/52.8.1-r0/mozjs-52.8.1/js/src/threading/Thread.h:122
>
> Finally able to test this locally across multiple builds, and these
> flags seems to be working fine as well.
>
> Looking around and it seems fedora is also using the flags you
> suggested, should we use them instead of '-fno-schedule-insns2'? If
> so, I can prepare another patch with the new changes.
>

yes we should, disabling a instructions schedule pass is too broad
when we can get over by doing a bit less

> Thanks,
> --
> Ricardo Salveti


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-16  2:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01  3:06 [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Ricardo Salveti
2018-08-01  3:06 ` [PATCH 2/2] mozjs: add support for RISC-V Ricardo Salveti
2018-08-02  8:34 ` [PATCH 1/2] mozjs: set -fno-schedule-insns2 on both CFLAGS and CXXFLAGS Khem Raj
2018-08-14 18:50   ` Andy
2018-08-16  2:17     ` Ricardo Salveti
2018-08-16  2:27       ` 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.