Untested, but can you try adding the attached patch? It looks like spidermonkey just forgot to copy some defines over for mips. If not I'll take a closer look at it.

~Brian

On 2019-12-01 5:14 AM, [email protected] wrote:
Hi Ports maintainers,

I'm having trouble to get devel/spidermonkey60 to build on mips64el.
The initial problem was the following error:

------8<------
usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/jit/mips64/LIR-mips64.h:17:45:
error: no matching function for call to 'js::jit::LInstructionHelper<1,
1, 0>::LInstructionHelper()'
    explicit LUnbox(const LAllocation& input) { setOperand(0, input); }
------8<------

It turned out that JIT was not well supported on MIPS as suggested in
the Debian bug[1], and the solution is to disable JIT on MIPS[2].  I
added it to the configure args and get passed this issue.  Probably this
patch[7] should be applied.

However the second issue is more complicated.  The error message is the
following:

------8<------
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/wasm/WasmSignalHandlers.cpp:101:26:
error: 'ucontext_t' {aka 'struct sigcontext'} has no member named
'sc_rsp'; did you mean 'sc_mask'?
  #define RSP_sig(p) ((p)->sc_rsp)
                           ^~~~~~
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/wasm/WasmSignalHandlers.cpp:450:19:
note: in expansion of macro 'RSP_sig'
  #define SP_sig(p) RSP_sig(p)
                    ^~~~~~~
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/wasm/WasmSignalHandlers.cpp:481:37:
note: in expansion of macro 'SP_sig'
    return reinterpret_cast<uint8_t*>(SP_sig(context));
                                      ^~~~~~
In file included from
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/js/src/Unified_cpp_js_src41.cpp:2:
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/wasm/WasmSignalHandlers.cpp:
In function 'uint8_t* ContextToLR(ucontext_t*)':
/usr/ports/pobj/spidermonkey-60.8.0/firefox-60.8.0/js/src/wasm/WasmSignalHandlers.cpp:451:19:
error: 'R31_sig' was not declared in this scope
  #define LR_sig(p) R31_sig(p)
------8<------

It seems that some members are missing from "struct sigcontext".  The
relevant code from Firefox can be found at [3], which assumes some
members are available on OpenBSD.  However, it turns out they are
available for some archs (e.g. AMD64[4]), but it's not for MIPS64[5].
The latest version of Firefox provides a more fine-grained check of
symbols for OpenBSD archs[6] but still assumes some symbols to be
available for all archs which are missing in MIPS64.  And I'm not sure
about how this can be handled properly.

On the other hand, I think this target is dragged in as an indirect
dependency of Emacs because I think it needs gjs and WASM may not be
required.  Is there a way to disable compiling the WASM part?


[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908486
[2]
https://salsa.debian.org/gnome-team/mozjs60/blob/debian/master/debian/rules#L42
[3]
https://hg.mozilla.org/mozilla-central/file/e33efdb3e1517d521deb949de3fcd6d9946ea440/js/src/wasm/WasmSignalHandlers.cpp#l103
[4]
https://github.com/openbsd/src/blob/b66614995ab119f75167daaa7755b34001836821/sys/arch/amd64/include/signal.h#L54
[5]
https://github.com/openbsd/src/blob/b66614995ab119f75167daaa7755b34001836821/sys/arch/mips64/include/signal.h#L56
[6]
https://hg.mozilla.org/mozilla-central/file/8504d70d827261346737af1cbe9b96acf6756b6d/js/src/wasm/WasmSignalHandlers.cpp#l80
[7] Patch for disabling JIT on MIPS* archs:

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/spidermonkey60/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile    26 Sep 2019 13:00:21 -0000      1.12
+++ Makefile    1 Dec 2019 10:12:07 -0000
@@ -78,6 +78,12 @@ CONFIGURE_ARGS =     --disable-debug \
  # /usr/bin/ld.lld: error: undefined symbol:
std::__1::basic_ostream<char, std::__1::char_traits<char>
::operator<<(unsigned long long)
  CONFIGURE_ARGS +=      --disable-js-shell

+# Build failure on mips64{,el}.  Related bug on Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908486
+# error: no matching function for call to
'js::jit::LInstructionHelper<1, 1, 0>::LInstructionHelper()'
+.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
+CONFIGURE_ARGS +=      --disable-ion
+.endif
+
  SO_VERSION =           ${LIBmozjs-${MOZILLA_VERSION}_VERSION}
  SUBST_VARS +=          SO_VERSION

cvs server: Diffing patches
cvs server: Diffing pkg


$OpenBSD$

Fully define all the registers needed on mips.

Index: js/src/wasm/WasmSignalHandlers.cpp
--- js/src/wasm/WasmSignalHandlers.cpp.orig
+++ js/src/wasm/WasmSignalHandlers.cpp
@@ -125,6 +125,8 @@ struct AutoSignalHandler {
 #if defined(__mips__)
 #define EPC_sig(p) ((p)->sc_pc)
 #define RFP_sig(p) ((p)->sc_regs[30])
+#define RSP_sig(p) ((p)->sc_regs[29])
+#define R31_sig(p) ((p)->sc_regs[31])
 #endif
 #if defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
     defined(__PPC64LE__)

Reply via email to