-
Notifications
You must be signed in to change notification settings - Fork 125
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
Sources for the included libgcc.a #74
Comments
I took some time to investigate. So, the libgcc.a is a part of newlib and consists of object files with the following signature:
This matches the RV32V003 architecture, which is RV32EC: 32-bit, embedded, with compression support. Note that the RVE line in the object file signatures signifies embedded. The absent is RVC, for compressed instructions. That's a little suboptimal in terms of code size, but otherwise fine. I've also built libgcc.a from scratch using the following steps:
The new library is 2663918 bytes. That's a little bit smaller than the libgcc.a checked into this repository, which is 2932544 bytes. The reason seems to be because the version I built supports compressed instructions, so they naturally take a bit less space:
I've verified that libgcc.a that was built using the instructions links fine with every example I tried, except self_modify_code, but that example seems to be broken with the existing libgcc.a as well, so it's not related. @cnlohr would you be open to a pull requests that adds a concise version of instructions on how to build libgcc.a near misc/libgcc.a? I will be happy to make one. Additionally, if you are interested in saving some bytes, I can also include the libgcc.a that has the compressed instructions baked in. Frankly, the savings are likely to be minor (within 10%), but when we only have 16 KB flash, maybe it would actually matter for some people? |
I would absolutely be up for it!!!! And if your new libgcc is better in (basically any way) then we should use it. I just found a totally random libgcc. I don't even remember where it came from. Please make the PR, @krasin |
I'm curious why it needs to be provided. I mean, if its part of the toolchain already, shouldn't everyone already have it? I mean, gcc itself, newlib and co - they're not provided, but are assumed to be present |
@cnlohr will do! Thank you for the encouragement. @prosper00 on Linux, it's not needed as gcc-riscv64-linux-gnu package has all/most necessary libgcc.a variants available:
README.md says: "An extra copy of libgcc so you can use unusual risc-v build chains, located in the misc/libgcc.a", but I hope that @cnlohr can elaborate more about that. |
Add instructions for building libgcc.a and update the binary. Fixes #74.
@cnlohr thank you for merging.
|
You mention needing to elaborate on that? Do you have a recommendation for what verbage we could use to clarify why one would want to use our build copy of libgcc? |
Hi @cnlohr , is there any particular use case / toolchain that you encountered and that's missing an appropriate libgcc.a? In the README.md you mention "unusual risc-v build chains", is there an example of that? Overall, it's all pretty minor. Thanks again for working on ch32v003fun! |
On the Windows compiler I recommend, there is no -EC libgcc included with it. So I threw it in. |
I see, thanks. |
Hi Charles,
thank you for working on the ch32v003fun SDK! It's very exciting to be able to use CH32V003 without any proprietary software (if combined with aappleby/PicoRVD).
Would it be possible to provide a link to the sources for the included libgcc.a and the way you built it? I appreciate the included binary as it's very convenient to have everything in place, but I would also like to know how to update this libgcc.a, when necessary.
The text was updated successfully, but these errors were encountered: