JS: add support for linking C sources
Support linking C sources with JS output of the JavaScript backend. See the added documentation in the users guide. The implementation simply extends the JS linker to use the objects (.o) that were already produced by the emcc compiler and which were filtered out previously. I've also added some options to control the link with C functions (see the documentation about pragmas). With this change I've successfully compiled the direct-sqlite package which embeds the sqlite.c database code. Some wrappers are still required (see the documentation about wrappers) but everything generic enough to be reused for other libraries have been integrated into rts/js/mem.js.
Showing
- compiler/GHC/Driver/Config/StgToJS.hs 19 additions, 0 deletionscompiler/GHC/Driver/Config/StgToJS.hs
- compiler/GHC/Driver/Flags.hs 1 addition, 0 deletionscompiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Pipeline.hs 6 additions, 8 deletionscompiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Session.hs 1 addition, 0 deletionscompiler/GHC/Driver/Session.hs
- compiler/GHC/Runtime/Interpreter/JS.hs 39 additions, 18 deletionscompiler/GHC/Runtime/Interpreter/JS.hs
- compiler/GHC/StgToJS/Linker/Linker.hs 236 additions, 148 deletionscompiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/StgToJS/Linker/Types.hs 24 additions, 40 deletionscompiler/GHC/StgToJS/Linker/Types.hs
- compiler/GHC/StgToJS/Linker/Utils.hs 5 additions, 42 deletionscompiler/GHC/StgToJS/Linker/Utils.hs
- compiler/GHC/StgToJS/Object.hs 224 additions, 57 deletionscompiler/GHC/StgToJS/Object.hs
- compiler/GHC/StgToJS/Types.hs 2 additions, 0 deletionscompiler/GHC/StgToJS/Types.hs
- compiler/GHC/Utils/Binary.hs 15 additions, 0 deletionscompiler/GHC/Utils/Binary.hs
- docs/users_guide/9.10.1-notes.rst 10 additions, 0 deletionsdocs/users_guide/9.10.1-notes.rst
- docs/users_guide/debugging.rst 8 additions, 0 deletionsdocs/users_guide/debugging.rst
- docs/users_guide/javascript.rst 113 additions, 0 deletionsdocs/users_guide/javascript.rst
- rts/js/mem.js 180 additions, 4 deletionsrts/js/mem.js
- rts/js/rts.js 37 additions, 8 deletionsrts/js/rts.js
- testsuite/tests/driver/all.T 1 addition, 1 deletiontestsuite/tests/driver/all.T
- testsuite/tests/driver/recomp011/all.T 0 additions, 1 deletiontestsuite/tests/driver/recomp011/all.T
- testsuite/tests/javascript/js-c-sources/js-c-sources01.hs 47 additions, 0 deletionstestsuite/tests/javascript/js-c-sources/js-c-sources01.hs
- testsuite/tests/javascript/js-c-sources/js-c-sources01.stdout 8 additions, 0 deletions...suite/tests/javascript/js-c-sources/js-c-sources01.stdout
Loading
Please register or sign in to comment