1
0
Fork
You've already forked zar
0
An attempt to write an archiver using zig
  • Zig 100%
Tom Read Cutting 5ee26e11bd
Some checks failed
CI / Build and test (push) Has been cancelled
CI / Test Redis (push) Has been cancelled
CI / Test handled errors are actually handled (push) Has been cancelled
CI / Build and test (pull_request) Has been cancelled
CI / Test Redis (pull_request) Has been cancelled
CI / Test handled errors are actually handled (pull_request) Has been cancelled
Prevent backslash escapes for github workspace path on windows
2025年12月06日 09:13:33 +01:00
.forgejo/workflow Add initial forgejo action runner as a test 2025年12月05日 07:54:57 +00:00
.github/workflows Prevent backslash escapes for github workspace path on windows 2025年12月06日 09:13:33 +01:00
.vscode Improve testing framework making it easier to: 2025年08月31日 21:02:29 +01:00
docs
src Implement workaround for windows child process directory handles not being supported 2025年12月06日 07:40:41 +00:00
test
.gitattributes
.gitignore
.gitmodules
build.zig Improve testing framework making it easier to: 2025年08月31日 21:02:29 +01:00
build.zig.zon Update to zig 0.15.2, remove workaround for bug that has now been fixed 2025年10月18日 07:24:45 +01:00
LICENSE
README.md Update zig link in README.md 2025年12月06日 07:57:46 +00:00
UsefulResources.md Update formatting and add explenation of/to UsefulResources.md 2025年12月06日 08:12:38 +00:00

Codeberg Runner Status: CI

Github Runner Status: CI

This repo contains an in-progress attempt to write an archiver in zig in order to solve this issue.

Note: This please file issues and pull requests on Codeberg, the github repository is a mirror of that.

Current Status

So the project did/has reached a state where it works as a drop-in replacement for llvm ar when used as an archiver when building redis on MacOS/Linux. Sometimes zig updates cause regressions which need to fixed.

CI has been setup for this.

Next steps

The next steps are to expand the testing suite (leveraging the testing harness that zld uses) to confirm zig ar can work as an llvm ar replacement under a wider set of circumstances (culminating in being used with the self-hosted compiler).

The current basic test-suite just compares the output of zig ar with llvm ar and validates the the results are byte-for-byte identical, however this isn't really ideal and probably stricter than what is needed.

Contributing

If you would like to contribute please do let me know! Progress on this project has be non-linear and I have busy periods, but if you ping an issue or DM me on Discord (I'm on the zig server, I will always aim to be responsive.

Other notes

The thing that make this tricky is that the "ar" format used as a basis for the archives that linkers use hasn't been standardised, meaning that depending on the platform being targeted - the format can vary in subtly different ways.

Three main variants to focus on (for now):

  • BSD (32 & 64 Bit) (the latter used on Darwin)
  • System V (or GNU) (32 & 64 BIT)
  • Windows

The goal is to make something that is a drop-in replacement for llvm-ar

The documentation for llvm-ar can be found here:

https://llvm.org/docs/CommandGuide/llvm-ar.html

The Wikipedia article on the format here:

https://en.wikipedia.org/wiki/Ar_(Unix)

A lot of the important operations supported by llvm-ar aren't actually documented in the program itself. However, as it is compatible with other ar implementations a reference man page for one of those can be found here:

https://man7.org/linux/man-pages/man1/ar.1.html