-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs for using LLVM toolchain with Webassembly #46
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakelang can you address the suggested changes to this PR?
Ping @jakelang |
@lrettig yo this PR is dead pretty much, I plan to migrate this stuff over to the readthedocs site. |
c2wasm.md
Outdated
|
||
## Install LLVM and Clang with the WASM backend | ||
|
||
### From the repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should offer the option to use the docker image we have.
I want to rewrite this. closing |
Please don't close. I'll cherry pick from it then. |
3e29617
to
0457722
Compare
Rebased on top of #132. |
```sh | ||
git clone http://llvm.org/git/llvm.git | ||
cd llvm/tools | ||
git clone http://llvm.org/git/clang.git | ||
cd ../projects | ||
git clone http://llvm.org/git/compiler-rt.git | ||
|
||
Then initialize CMake: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why these two steps needs to be separate (initialise + build).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helps to annotate
|
||
Note: the last step can also be accomplished with [wabt](https://github.com/webassembly/wabt) (previously called *sexpr-wasm-prototype*). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep this note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually the list of steps is gone and we need binaryen anyway for s2wasm
clang.md
Outdated
s2wasm -o hello.wast hello.s | ||
wasm-as -o hello.wasm hello.wast | ||
``` | ||
Next we can generate linear WASM output from the bitcode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a "linear WASM output" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linear assembly format that WASM specifies
also i stopped maintaining this a while ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linear assembly format that WASM specifies
I'm also not sure what this means. Could you link to another doc that explains this?
Also needs to include a note about wasm-chisel (can copy it off the Rust PR) |
clang.md
Outdated
|
||
There you go, you have your very first WebAssembly binary. | ||
The code will now be in WAST format but must be cleaned up with `ewasm-cleanup` to be deployed as a contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to wasm-chisel
instead of ewasm-cleanup
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
## Install Binaryen | ||
|
||
This one is much easier. Simply: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you link to the binaryen master install docs here? In case these steps change or something.
@@ -1,54 +1,73 @@ | |||
# Compiling C/C++ to WebAssembly | |||
|
|||
## Rolling your own compiler | |||
Many high level languages already support compilation to WebAssembly | |||
through the experimental LLVM backend. Unfortunately, it is a tedious |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experimental LLVM backend
Could you please add a link to further documentation on this? Why is it "experimental"?
``` | ||
|
||
## Using this compiler | ||
CMake will also generate an `install` target if you want to actually install Binaryen on your system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you run this? cmake install
? Could you please make that explicit here?
clang.md
Outdated
|
||
There you go, you have your very first WebAssembly binary. | ||
The code will now be in WAST format but must be cleaned up with [wasm-chisel](https://github.com/wasmx/wasm-chisel) to be deployed as a contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be cleaned up with wasm-chisel
Could you please make it explicit how to do this? Is it just a command you need to run? Do you need to clone the repo and compile and run? Etc.
clang.md
Outdated
s2wasm -o hello.wast hello.s | ||
wasm-as -o hello.wasm hello.wast | ||
``` | ||
Next we can generate linear WASM output from the bitcode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linear assembly format that WASM specifies
I'm also not sure what this means. Could you link to another doc that explains this?
Closes #111.