https://github.com/windowsair/llvm-objcopy-wasm
A port of llvm-objcopy to WebAssembly
https://github.com/windowsair/llvm-objcopy-wasm
Last synced: about 2 months ago
JSON representation
A port of llvm-objcopy to WebAssembly
- Host: GitHub
- URL: https://github.com/windowsair/llvm-objcopy-wasm
- Owner: windowsair
- License: mit
- Created: 2023-12-31T12:16:26.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T08:27:50.000Z (almost 2 years ago)
- Last Synced: 2025-02-14T06:46:34.026Z (10 months ago)
- Language: JavaScript
- Homepage: https://llvm-objcopy-wasm.vercel.app
- Size: 1.13 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# llvm-objcopy-wasm
A port of llvm-objcopy to WebAssembly.
# Feature
- LLVM 17.0.6
- Target :
AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SystemZ, WebAssembly, X86, XCore
# Install
```bash
npm i llvm-objcopy-wasm
```
# Usage
```js
import Module from 'src/llvm-objcopy.mjs'
let handle = await Module()
let args = []
let exitCode = handle.callMain(args)
// See console:
// OVERVIEW: llvm-objcopy tool
//
// USAGE: llvm-objcopy [options] input [output]
//
// ...
```
**Note that the `callMain()` method is non-reentrant.** This means that when you want to call `callMain` multiple times, you need to do it on a new Module instance.
For more information, see: [llvm-objcopy Document](https://llvm.org/docs/CommandGuide/llvm-objcopy.html)
# Example
## 1. Covert input file to binary format in browser
Equivalent command line:
```bash
llvm-objcopy -O binary input outout
```
Try it online: [convert-to-binary](https://llvm-objcopy-wasm.vercel.app/example/convert-to-binary.html)
Source code: [example/convert-to-binary.html](https://github.com/windowsair/llvm-objcopy-wasm/blob/master/example/convert-to-binary.html)