Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kubkon/zld
Zig's ld drop-in replacement
https://github.com/kubkon/zld
linker zig zig-package
Last synced: 3 months ago
JSON representation
Zig's ld drop-in replacement
- Host: GitHub
- URL: https://github.com/kubkon/zld
- Owner: kubkon
- License: mit
- Created: 2021-01-23T06:25:16.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T10:26:37.000Z (8 months ago)
- Last Synced: 2024-05-22T12:57:08.435Z (8 months ago)
- Topics: linker, zig, zig-package
- Language: Zig
- Homepage:
- Size: 4.26 MB
- Stars: 221
- Watchers: 12
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - zld🗒️Zig's lld drop-in replacement
README
# zld
`zld` is a drop-in replacement for your system linker `ld` written in Zig.
## Quick start guide
### Building
You will need latest Zig in your path. You can get nightly binaries from [here](https://ziglang.org/download/).
```
$ zig build
```This will create the `ld.zld` (Elf), `ld64.zld` (MachO), `link-zld` (Coff) and `wasm-zld` (Wasm) binaries in `zig-out/bin/`.
You can then use it like you'd use a standard linker.```
$ cat < hello.c
#includeint main() {
fprintf(stderr, "Hello, World!\n");
return 0;
}
EOF# Create .o using system clang
$ clang -c hello.c# Or, create .o using zig cc
$ zig cc -c hello.c# On macOS
$ ./zig-out/bin/ld64.zld hello.o -o hello# On Linux
$ ./zig-out/bin/ld.zld hello.o -o hello# Run!
$ ./hello
```### Testing
If you'd like to run unit and end-to-end tests, run the tests like you'd normally do for any other Zig project.
```
$ zig build test
```## Supported backends
- [x] Mach-O (x86_64)
- [x] Mach-O (aarch64)
- [x] ELF (x86_64)
- [x] ELF (aarch64)
- [ ] ELF (riscv64)
- [ ] COFF (x86_64)
- [ ] COFF (aarch64)
- [x] Wasm (static)## Contributing
You are welcome to contribute to this repo.