Bug 202229

Summary: lang/spidermonkey170 does not build on ARM
Product: Ports & Packages Reporter: Ulrich Grey <usenet>
Component: Individual Port(s)Assignee: Koop Mast <kwm>
Status: Closed FIXED    
Severity: Affects Some People CC: brd, dim, freebsd-arm, gecko, jbeich, mikael, rwestlun, sbruno
Priority: --- Flags: bugzilla: maintainer-feedback? (kwm)
Version: Latest   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
add cacheFlush() for arm
none
armv6 fix
none
jsapi .c and .sh output files from clang crashes.
none
jsarray .c and .sh output files from clang crashes.
none
jsnum .c and .sh output files from clang crashes. none

Description Ulrich Grey 2015-08-10 21:03:47 UTC
/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src/jsanalyze.cpp:7:
#  define MOZ_STATIC_ASSERT_GLUE(x, y)           MOZ_STATIC_ASSERT_GLUE1(x, y)In file included from ./jsanalyze.h:13:
In file included from ./jscompartment.h:19:
In file included from ./vm/RegExpObject.h:21:
In file included from ./yarr/YarrJIT.h:37:
In file included from ./assembler/assembler/MacroAssembler.h:42:
In file included from ./assembler/assembler/MacroAssemblerARM.h:39:
ESC[1m./assembler/assembler/ARMAssembler.h:1070:34: error: no member named 'cacheFlush' in 'JSC::ExecutableAllocator'
                                               ^
            ExecutableAllocator::cacheFlush(insn, sizeof(ARMWord));

[...]

config/rules.mk:1017: recipe for target 'jsatom.o' failed
gmake[3]: *** [jsatom.o] Error 1
gmake[3]: Leaving directory '/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src'
config/rules.mk:576: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src'
===> Compilation failed unexpectedly.
Comment 1 Sean Bruno freebsd_committer 2015-08-13 16:37:23 UTC
This looks like it need similar treatment as we did for later revisions of spidermonkey, namely the clearCache instruction.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197058
Comment 2 Randy Westlund 2015-08-15 22:31:12 UTC
I just ran into the same problem using poudriere to build for my beagle.  Unfortunately polkit requires it :/
Comment 3 Koop Mast freebsd_committer 2015-08-16 11:12:15 UTC
Created attachment 159916 [details]
add cacheFlush() for arm

Could you try this patch on arm? I copied it from the spidermonkey24 port.
Comment 4 Mikael Urankar freebsd_committer 2015-08-16 11:24:33 UTC
Created attachment 159917 [details]
armv6 fix

Can you try the attached patch?
Comment 5 Sean Bruno freebsd_committer 2015-08-16 17:06:15 UTC
And now I'm able to get to a clang assertion on head:

In file included from ./yarr/Yarr.h:37:
./yarr/YarrInterpreter.h:81:17: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
                struct {
                ^
./yarr/YarrInterpreter.h:78:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./yarr/YarrInterpreter.h:95:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
Assertion failed: ((PartVT.isInteger() || PartVT == MVT::x86mmx) && ValueVT.isInteger() && "Unknown mismatch!"), function getCopyToParts, file /usr/src/lib/clang/libllvmselectiondag/../../../contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, line 398.
Stack dump:
0.      Program arguments: /nxb-bin/usr/bin/c++ -cc1 -triple armv6--freebsd11.0-gnueabi -emit-obj -disable-free -main-file-name jsapi.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -masm-verbose -mconstructor-aliases -target-cpu arm1176jzf-s -target-feature +soft-float-abi -target-abi aapcs-linux -mfloat-abi soft -dwarf-column-info -ffunction-sections -fdata-sections -coverage-file /wrkdirs/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src/jsapi.o -resource-dir /nxb-bin/usr/bin/../lib/clang/3.6.1 -dependency-file .deps/jsapi.o.pp -MT jsapi.o -sys-header-deps -include ./js-confdefs.h -D ENABLE_YARR_JIT=1 -D IMPL_MFBT -D EXPORT_JS_API -D NO_NSPR_10_SUPPORT -D USE_ZLIB -D NDEBUG -D TRIMMED -D USE_SYSTEM_MALLOC=1 -D ENABLE_ASSEMBLER=1 -D ENABLE_JIT=1 -D MOZILLA_CLIENT -I ./../../mfbt/double-conversion -I . -I . -I ./dist/include -I /usr/local/include/nspr -I . -I ./assembler -I ./yarr -I /usr/local/include -I /usr/local/include -internal-isystem /usr/include/c++/v1 -O2 -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wno-c++0x-extensions -Wno-extended-offsetof -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags -Wno-long-long -pedantic -fdeprecated-macro -fdebug-compilation-dir /wrkdirs/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -mstackrealign -fno-rtti -fno-signed-char -fobjc-runtime=gnustep -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o jsapi.o -x c++ /wrkdirs/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src/jsapi.cpp 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/wrkdirs/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src/jsapi.cpp'.
4.      Running pass 'ARM Instruction Selection' on function '@JS_DoubleToInt32'
In file included from /wrkdirs/usr/ports/lang/spidermonkey170/work/mozjs17.0.0/js/src/jsopcode.cpp:44:
In file included from ./vm/Debugger.h:19:
In file included from ./jswrapper.h:14:
Comment 6 Sean Bruno freebsd_committer 2015-08-16 17:09:08 UTC
Created attachment 159925 [details]
jsapi   .c and .sh output files from clang crashes.
Comment 7 Sean Bruno freebsd_committer 2015-08-16 17:09:35 UTC
Created attachment 159926 [details]
jsarray   .c and .sh output files from clang crashes.
Comment 8 Sean Bruno freebsd_committer 2015-08-16 17:09:59 UTC
Created attachment 159927 [details]
jsnum   .c and .sh output files from clang crashes.
Comment 9 Ulrich Grey 2015-08-17 07:01:27 UTC
I have applied the Patch from Mikaƫl Urankar (https://bugs.freebsd.org/bugzilla/attachment.cgi?id=159917&action=diff).
I have built lang/spidermonkey170 successfully with lang/gcc6-devel

gcc version 6.0.0 20150802 (experimental) (FreeBSD Ports Collection)
Comment 10 Dimitry Andric freebsd_committer 2015-08-17 13:22:09 UTC
This was already reported earlier in bug 199450, and filed upstream at:

https://llvm.org/bugs/show_bug.cgi?id=23229
Comment 11 commit-hook freebsd_committer 2015-08-25 21:59:54 UTC
A commit references this bug:

Author: kwm
Date: Tue Aug 25 21:59:20 UTC 2015
New revision: 395317
URL: https://svnweb.freebsd.org/changeset/ports/395317

Log:
  Fix the build on ARM by adapting a patch from spidermonkey24.

  PR:		202229
  Submitted by:	mikael.urankar@gmail.com

Changes:
  head/lang/spidermonkey170/files/patch-assembler_jit_ExecutableAllocator.h
Comment 12 Koop Mast freebsd_committer 2015-08-25 22:01:11 UTC
Patch committed, thanks. Closing since the Clang assert on HEAD is already recorded in another bug and is already reported to clang upstream.