Skip to content

Commit

Permalink
Merge branch 'release' of github.com:yomaytk/elfconv into release
Browse files Browse the repository at this point in the history
  • Loading branch information
yomaytk committed Apr 4, 2024
2 parents 11f7595 + 15b9493 commit 4572121
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ and elfconv uses [emscripten](https://github.com/emscripten-core/emscripten) (fo
- Furthermore, a part of aarch64 instructions are not supported. if the instruction of your ELF binary is not supported, elfconv outputs the message (\[WARNING\] Unsupported instruction at 0x...)
- No support of stripped binaries
- No support of shared objects
- a lot of Linux system calls are unimplemented(ref: `runtime/syscalls`)
- a lot of Linux system calls are unimplemented(ref: [`runtime/syscalls`](https://github.com/yomaytk/elfconv/blob/main/runtime/syscalls))
## Quick Start
You can try elfconv using docker container (amd64 and arm64) by executing the commands as follows.
In default settings, both `elflift` (used for generating LLVM bitcode file) and `libelfconv.a` (used for executing generated LLVM bitcode) are installed to `~/.elfconv`.
You can execute WASM application on the both browser and host environment (WASI runtimes).
> [!WARNING]
> The container generated by the Dockerfile includes the installation of [wasi-sdk](https://github.com/WebAssembly/wasi-sdk). However, wasi-sdk doesn't release the package for arm64, so we build wasi-sdk in the arm64 container image, and it takes long times. If you just try elfconv, it might be good to elfconv release packages, or comment out the lines of the installation of wasi-sdk (The relevant part is as follows in the Dockerfile) and use emscripten instead of that.
> The container generated by the Dockerfile includes the installation of [wasi-sdk](https://github.com/WebAssembly/wasi-sdk). However, wasi-sdk doesn't release the package for arm64, so we build wasi-sdk in the arm64 container image, and it takes long times. If you just try elfconv, it might be good to elfconv [release packages](https://github.com/yomaytk/elfconv/releases), or comment out the lines of the installation of wasi-sdk (The relevant part is as follows in the Dockerfile) and use emscripten instead of that.
> ```sh
> elif [ "$( uname -m )" = "aarch64" ]; then \
> cd /root && git clone --recursive https://github.com/WebAssembly/wasi-sdk.git; \
Expand Down Expand Up @@ -54,13 +54,13 @@ $ docker run -it --name elfconv-container elfconv-image
## Build
You can easily build and develop elfconv on the container. Thus, please see [Quick Start](#quick-start) and prepare the docker container if you have not done it.

After executing `./scripts/build.sh` (please see [Quick Start](#quick-start)) , `elfconv/build` directory is generated and you can build with ninja build system. `ninja` builds the module that translates the ELF binary to LLVM bitcode (`backend/remill/` and `lifter/`).
After executing [`scripts/build.sh`](https://github.com/yomaytk/elfconv/blob/main/scripts/build.sh) (please see [Quick Start](#quick-start)) , `elfconv/build` directory is generated and you can build with ninja build system. `ninja` builds the module that translates the ELF binary to LLVM bitcode ([`backend/remill/`](https://github.com/yomaytk/elfconv/tree/main/backend/remill) and [`lifter/`](https://github.com/yomaytk/elfconv/tree/main/lifter)).

```shell
~/elfconv/build# ninja
```

After that, you can compile the ELF binary to the WASM binary using `scripts/dev.sh` as follows. `dev.sh` execute the translation and compiles the `runtime/` (statically linked with generated LLVM bitcode) and generate the WASM binary. when you execute the script, you should explicitly specify the path of elfconv directory (`/root/elfconv` on the container) with `NEW_ROOT` or rewrite the `ROOT_DIR` in `dev.sh`.
After that, you can compile the ELF binary to the WASM binary using [`scripts/dev.sh`](https://github.com/yomaytk/elfconv/blob/main/scripts/dev.sh) as follows. `dev.sh` execute the translation and compiles the `runtime/` (statically linked with generated LLVM bitcode) and generate the WASM binary. when you execute the script, you should explicitly specify the path of elfconv directory (`/root/elfconv` on the container) with `NEW_ROOT` or rewrite the `ROOT_DIR` in `dev.sh`.
```shell
### Browser
~/elfconv/build# NEW_ROOT=/path/to/elfconv TARGET=wasm-browser ../scripts/dev.sh path/to/ELF # generate the WASM binary under the elfconv/build/lifter
Expand Down

0 comments on commit 4572121

Please sign in to comment.