Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binji/wasm-clang
Running Clang/LLD in WebAssembly Demo
https://github.com/binji/wasm-clang
Last synced: 1 day ago
JSON representation
Running Clang/LLD in WebAssembly Demo
- Host: GitHub
- URL: https://github.com/binji/wasm-clang
- Owner: binji
- License: apache-2.0
- Created: 2019-08-19T16:11:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-07T18:35:20.000Z (11 months ago)
- Last Synced: 2024-08-02T06:11:40.964Z (3 months ago)
- Language: JavaScript
- Homepage: https://binji.github.io/wasm-clang
- Size: 48.3 MB
- Stars: 257
- Watchers: 16
- Forks: 26
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wasi - Wasm Clang
README
# Clang/LLD in WebAssembly
This is the demo for my CppCon 2019 talk! You can view the talk on [youtube](https://www.youtube.com/watch?v=5N4b-rU-OAA)
Thing should work, but it's still very much alpha demoware. Go to https://binji.github.io/wasm-clang to see it in action.
Most of the JavaScript code can be found here. If you're interested in the implementation of the in-memory filesystem, take a look at https://github.com/binji/llvm-project/tree/master/binji.
Some notes on how I built this, sorry that they are relatively sparse: https://gist.github.com/binji/b7541f9740c21d7c6dac95cbc9ea6fca
# Directory structure
## Shared utilities
- `clang`: clang compiler, compiled to wasm w/ WASI
- `lld`: lld linker, compiled to wasm w/ WASI
- `main`.css
- `memfs`: WASI implementation of in-memory filesystem,
- `shared.js`: shared utilities for all tools (web and d8)
- `shared_web.js`: shared utilities for all web tools (asm.html, index.html, etc.)
- `sysroot.tar`: C++ standard headers and libraries
- `service_worker.js`: Service worker used by all web pages
- `worker.js`: Dedicated work used to compile/run## Assemble 6502 code
- `6502.html`
- `6502.js`
- `vasm6502_oldstyle`: [vasm assembler](http://sun.hasenbraten.de/vasm/) compiled to wasm w/ WASI## Compile C++ code to x86/wasm assembly
- `asm.html`
- `asm.js`## Compile C++ code in d8 (v8's console shell)
- `d8.js`
## Compile and run C++ code
- `index.html`
- `web.js`